<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
		>
<channel>
	<title>Comments on: Creating a Data Access Layer with Linq to SQL, part 2</title>
	<atom:link href="http://krisvandermotten.wordpress.com/2006/11/30/creating-a-data-access-layer-with-linq-to-sql-part-2/feed/" rel="self" type="application/rss+xml" />
	<link>http://krisvandermotten.wordpress.com/2006/11/30/creating-a-data-access-layer-with-linq-to-sql-part-2/</link>
	<description>Kris Vandermotten's blog</description>
	<lastBuildDate>Sat, 09 May 2009 00:04:07 +0000</lastBuildDate>
	<generator>http://wordpress.com/</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: gsdwriter</title>
		<link>http://krisvandermotten.wordpress.com/2006/11/30/creating-a-data-access-layer-with-linq-to-sql-part-2/#comment-2632</link>
		<dc:creator>gsdwriter</dc:creator>
		<pubDate>Sat, 09 May 2009 00:04:07 +0000</pubDate>
		<guid isPermaLink="false">http://krisvandermotten.wordpress.com/2006/11/30/creating-a-data-access-layer-with-linq-to-sql-part-2/#comment-2632</guid>
		<description>How you use Linq to SQL depends on what problem you need to solve.

Let&#039;s say you are building an app that needs to be written quickly, will allow users to enter criteria for reports that it will then display, that it will run against SQL Server and the possibility of ever changing to another database (like Oracle, etc.) is remote.  Do you really need a formal DAL?  Can you get away with runing SQLMetal and having some Linq to SQL queries in your UI?  Probably.

What if you are building an app that may get really big and end up being split across multiple physical machines?  Clearly you need a formal DAL and there is no way you are going to be passing IQueryable&#039;s around.

Linq to SQL is a new tool that we can now use to solve the problems we hit, but it is not a &quot;one size fits all&quot; solution.</description>
		<content:encoded><![CDATA[<p>How you use Linq to SQL depends on what problem you need to solve.</p>
<p>Let&#8217;s say you are building an app that needs to be written quickly, will allow users to enter criteria for reports that it will then display, that it will run against SQL Server and the possibility of ever changing to another database (like Oracle, etc.) is remote.  Do you really need a formal DAL?  Can you get away with runing SQLMetal and having some Linq to SQL queries in your UI?  Probably.</p>
<p>What if you are building an app that may get really big and end up being split across multiple physical machines?  Clearly you need a formal DAL and there is no way you are going to be passing IQueryable&#8217;s around.</p>
<p>Linq to SQL is a new tool that we can now use to solve the problems we hit, but it is not a &#8220;one size fits all&#8221; solution.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: SicaAmica</title>
		<link>http://krisvandermotten.wordpress.com/2006/11/30/creating-a-data-access-layer-with-linq-to-sql-part-2/#comment-2631</link>
		<dc:creator>SicaAmica</dc:creator>
		<pubDate>Wed, 22 Apr 2009 13:04:23 +0000</pubDate>
		<guid isPermaLink="false">http://krisvandermotten.wordpress.com/2006/11/30/creating-a-data-access-layer-with-linq-to-sql-part-2/#comment-2631</guid>
		<description>mm. informative )</description>
		<content:encoded><![CDATA[<p>mm. informative )</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: noiser</title>
		<link>http://krisvandermotten.wordpress.com/2006/11/30/creating-a-data-access-layer-with-linq-to-sql-part-2/#comment-2629</link>
		<dc:creator>noiser</dc:creator>
		<pubDate>Wed, 19 Nov 2008 15:50:44 +0000</pubDate>
		<guid isPermaLink="false">http://krisvandermotten.wordpress.com/2006/11/30/creating-a-data-access-layer-with-linq-to-sql-part-2/#comment-2629</guid>
		<description>has any consensus been reached yet?

i&#039;m struggling with the same architectural dilemma and it seems like where ever i go to find help on it all i find is other people with the same problem but only with so-so workarounds and they all seem to differ to.

so far i&#039;m agreeing with what progrmr said, that you simple have to pass IEnumerables up to the BAL and basically remap the result to a native format for the UI. i&#039;m thinking im simply gonna have to create business entities and populate them from the result. seems a bit redundant though!</description>
		<content:encoded><![CDATA[<p>has any consensus been reached yet?</p>
<p>i&#8217;m struggling with the same architectural dilemma and it seems like where ever i go to find help on it all i find is other people with the same problem but only with so-so workarounds and they all seem to differ to.</p>
<p>so far i&#8217;m agreeing with what progrmr said, that you simple have to pass IEnumerables up to the BAL and basically remap the result to a native format for the UI. i&#8217;m thinking im simply gonna have to create business entities and populate them from the result. seems a bit redundant though!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: LINQ and multi-tier architecture design</title>
		<link>http://krisvandermotten.wordpress.com/2006/11/30/creating-a-data-access-layer-with-linq-to-sql-part-2/#comment-2622</link>
		<dc:creator>LINQ and multi-tier architecture design</dc:creator>
		<pubDate>Sat, 26 Jul 2008 22:56:26 +0000</pubDate>
		<guid isPermaLink="false">http://krisvandermotten.wordpress.com/2006/11/30/creating-a-data-access-layer-with-linq-to-sql-part-2/#comment-2622</guid>
		<description>[...] http://krisvandermotten.wordpress.com/2006/11/30/creating-a-data-access-layer-with-linq-to-sql-part-... [...]</description>
		<content:encoded><![CDATA[<p>[...] <a href="http://krisvandermotten.wordpress.com/2006/11/30/creating-a-data-access-layer-with-linq-to-sql-part-.." rel="nofollow">http://krisvandermotten.wordpress.com/2006/11/30/creating-a-data-access-layer-with-linq-to-sql-part-..</a>. [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Daniel GAVARIN</title>
		<link>http://krisvandermotten.wordpress.com/2006/11/30/creating-a-data-access-layer-with-linq-to-sql-part-2/#comment-2598</link>
		<dc:creator>Daniel GAVARIN</dc:creator>
		<pubDate>Fri, 01 Feb 2008 11:05:16 +0000</pubDate>
		<guid isPermaLink="false">http://krisvandermotten.wordpress.com/2006/11/30/creating-a-data-access-layer-with-linq-to-sql-part-2/#comment-2598</guid>
		<description>Sorry for my english.

I think that it&#039;s to hard to build a solid architecture with Linq To SQL ( I dont&#039;t talk about Linq but only Linq To SQL ).

But you can see a solution in writing this :

DAL = CRUD on DLINQ with Expression in output IEnumerable, and symple type, you can use class of SQLMetal (I you want to Optimise Query maybe you need to change UpdateCheck, because i don&#039;t find any solution to change this value in runtime)

BIZ = use class of DAL, Linq to Object and prepare Expression for DAL

UI : Use BIZ, linq to Object

It&#039;s ok, but its not a solid architecture because you loose Entity concept, and when you try to work in SOA architecture you will to find with Entity to DataTable and true Entity !!!???? It&#039;s not good

A good idea, it&#039;s to use a best linq provider to access DataBase because DLinq is nearest SQLServer, and that force to have a bottom up vision.</description>
		<content:encoded><![CDATA[<p>Sorry for my english.</p>
<p>I think that it&#8217;s to hard to build a solid architecture with Linq To SQL ( I dont&#8217;t talk about Linq but only Linq To SQL ).</p>
<p>But you can see a solution in writing this :</p>
<p>DAL = CRUD on DLINQ with Expression in output IEnumerable, and symple type, you can use class of SQLMetal (I you want to Optimise Query maybe you need to change UpdateCheck, because i don&#8217;t find any solution to change this value in runtime)</p>
<p>BIZ = use class of DAL, Linq to Object and prepare Expression for DAL</p>
<p>UI : Use BIZ, linq to Object</p>
<p>It&#8217;s ok, but its not a solid architecture because you loose Entity concept, and when you try to work in SOA architecture you will to find with Entity to DataTable and true Entity !!!???? It&#8217;s not good</p>
<p>A good idea, it&#8217;s to use a best linq provider to access DataBase because DLinq is nearest SQLServer, and that force to have a bottom up vision.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Stiiifff</title>
		<link>http://krisvandermotten.wordpress.com/2006/11/30/creating-a-data-access-layer-with-linq-to-sql-part-2/#comment-2597</link>
		<dc:creator>Stiiifff</dc:creator>
		<pubDate>Mon, 28 Jan 2008 09:25:43 +0000</pubDate>
		<guid isPermaLink="false">http://krisvandermotten.wordpress.com/2006/11/30/creating-a-data-access-layer-with-linq-to-sql-part-2/#comment-2597</guid>
		<description>Well, actually, Querying &#039;is&#039; a business concern:
http://www.ayende.com/Blog/archive/2007/03/09/Querying-is-a-business-concern.aspx

Why would we write static-named methods for all possible queries we have to make on our Domain Model ?
Linq to SQL is bringing DDD to the mass ... and it is indeed a problem if you still think in terms of &#039;layers&#039; instead of &#039;services&#039;.

In DDD, your Domain Model contains data structure AND business logic. The Repositories abstract your domain model from the &#039;boiler-plate data access code&#039;. Concerning the Service Layer, you don&#039;t actually need one. If you have one, it can be very thin, just acting as a bridge/facade.

See the &#039;BackgroundMotion&#039; website architecture as a living example of those concepts. Kudos to Andrew ;o)</description>
		<content:encoded><![CDATA[<p>Well, actually, Querying &#8216;is&#8217; a business concern:<br />
<a href="http://www.ayende.com/Blog/archive/2007/03/09/Querying-is-a-business-concern.aspx" rel="nofollow">http://www.ayende.com/Blog/archive/2007/03/09/Querying-is-a-business-concern.aspx</a></p>
<p>Why would we write static-named methods for all possible queries we have to make on our Domain Model ?<br />
Linq to SQL is bringing DDD to the mass &#8230; and it is indeed a problem if you still think in terms of &#8216;layers&#8217; instead of &#8217;services&#8217;.</p>
<p>In DDD, your Domain Model contains data structure AND business logic. The Repositories abstract your domain model from the &#8216;boiler-plate data access code&#8217;. Concerning the Service Layer, you don&#8217;t actually need one. If you have one, it can be very thin, just acting as a bridge/facade.</p>
<p>See the &#8216;BackgroundMotion&#8217; website architecture as a living example of those concepts. Kudos to Andrew ;o)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: progrmr</title>
		<link>http://krisvandermotten.wordpress.com/2006/11/30/creating-a-data-access-layer-with-linq-to-sql-part-2/#comment-2565</link>
		<dc:creator>progrmr</dc:creator>
		<pubDate>Wed, 16 Jan 2008 14:52:31 +0000</pubDate>
		<guid isPermaLink="false">http://krisvandermotten.wordpress.com/2006/11/30/creating-a-data-access-layer-with-linq-to-sql-part-2/#comment-2565</guid>
		<description>I agree with the fullest seperation between the BLL and the DAL in an application - so returning T[] or IEnumerable is the way to go. 

I also see the point of one poster above that the presentation layer cannot/should not communicate with the DAL - meaning that the BLL is going to have to handle results returned to it and return to the presentation a native format that doesn&#039;t worry about the underlying entity classes.</description>
		<content:encoded><![CDATA[<p>I agree with the fullest seperation between the BLL and the DAL in an application &#8211; so returning T[] or IEnumerable is the way to go. </p>
<p>I also see the point of one poster above that the presentation layer cannot/should not communicate with the DAL &#8211; meaning that the BLL is going to have to handle results returned to it and return to the presentation a native format that doesn&#8217;t worry about the underlying entity classes.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Christian Staffe</title>
		<link>http://krisvandermotten.wordpress.com/2006/11/30/creating-a-data-access-layer-with-linq-to-sql-part-2/#comment-2547</link>
		<dc:creator>Christian Staffe</dc:creator>
		<pubDate>Wed, 16 Jan 2008 09:34:58 +0000</pubDate>
		<guid isPermaLink="false">http://krisvandermotten.wordpress.com/2006/11/30/creating-a-data-access-layer-with-linq-to-sql-part-2/#comment-2547</guid>
		<description>I fully agree that the DAL should return array of entities (T[] or List for instance and not IQueryable. Now a further problem related to SOA is which kind of object you return. 

Let&#039;s take an example, you have a customer, account and reporting service for instance and a single database. You can design try to assign each table to a specific service, having one DAL per service but each service is able to use the DAL of the other services. That&#039;s not &quot;pure&quot; SOA but it&#039;s reasonable to do this in my opinion. 

But this also implies that your business entities (the ones returned by the DAL) also need to be shared between services as they are interconnected (a client has a list of accounts for instance). But this starts to defeat the purpose of services. Depending on the service, I would like to design my entities with only the data related to the domain covered by the service but then it leads to a lot of duplicated code describing the entities.

Does someone have some insight/experience with this problem ?</description>
		<content:encoded><![CDATA[<p>I fully agree that the DAL should return array of entities (T[] or List for instance and not IQueryable. Now a further problem related to SOA is which kind of object you return. </p>
<p>Let&#8217;s take an example, you have a customer, account and reporting service for instance and a single database. You can design try to assign each table to a specific service, having one DAL per service but each service is able to use the DAL of the other services. That&#8217;s not &#8220;pure&#8221; SOA but it&#8217;s reasonable to do this in my opinion. </p>
<p>But this also implies that your business entities (the ones returned by the DAL) also need to be shared between services as they are interconnected (a client has a list of accounts for instance). But this starts to defeat the purpose of services. Depending on the service, I would like to design my entities with only the data related to the domain covered by the service but then it leads to a lot of duplicated code describing the entities.</p>
<p>Does someone have some insight/experience with this problem ?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Darick Carpenter</title>
		<link>http://krisvandermotten.wordpress.com/2006/11/30/creating-a-data-access-layer-with-linq-to-sql-part-2/#comment-2341</link>
		<dc:creator>Darick Carpenter</dc:creator>
		<pubDate>Wed, 09 Jan 2008 21:14:21 +0000</pubDate>
		<guid isPermaLink="false">http://krisvandermotten.wordpress.com/2006/11/30/creating-a-data-access-layer-with-linq-to-sql-part-2/#comment-2341</guid>
		<description>I think one of the benefits of having a tiered approach is the ability to change datasources easily.  It seems that using LINQ you wouldn&#039;t be able to do that.  If you are passing an IQueryable object to business and ui layers, then if you need to change your data source then you have to make changes throughout the business and ui layers too.  Though there may be workarounds for this they would cumbersome.  Ideally you should be able to swap dals that come from different sources without the need to re-write any of the bl or ui layers (sources such as Oracle, mySql, Sql Server, or xml).  It seems that this would just be difficult to do with LINQ.  It would nice (and maybe you can do this) to be able to use LINQ and then easily populate a dataset and then pass the dataset or datatables between your layers.  Then if the need arises to change sources you can keep the dataset and just use dataadapters to populate them from the new source.  Then your other layers would not have any knowledge of how or where the data comes from, which is how it should be.

I do think that it will be very handy to be able to query against objects though.</description>
		<content:encoded><![CDATA[<p>I think one of the benefits of having a tiered approach is the ability to change datasources easily.  It seems that using LINQ you wouldn&#8217;t be able to do that.  If you are passing an IQueryable object to business and ui layers, then if you need to change your data source then you have to make changes throughout the business and ui layers too.  Though there may be workarounds for this they would cumbersome.  Ideally you should be able to swap dals that come from different sources without the need to re-write any of the bl or ui layers (sources such as Oracle, mySql, Sql Server, or xml).  It seems that this would just be difficult to do with LINQ.  It would nice (and maybe you can do this) to be able to use LINQ and then easily populate a dataset and then pass the dataset or datatables between your layers.  Then if the need arises to change sources you can keep the dataset and just use dataadapters to populate them from the new source.  Then your other layers would not have any knowledge of how or where the data comes from, which is how it should be.</p>
<p>I do think that it will be very handy to be able to query against objects though.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Narek</title>
		<link>http://krisvandermotten.wordpress.com/2006/11/30/creating-a-data-access-layer-with-linq-to-sql-part-2/#comment-2256</link>
		<dc:creator>Narek</dc:creator>
		<pubDate>Fri, 14 Dec 2007 19:03:45 +0000</pubDate>
		<guid isPermaLink="false">http://krisvandermotten.wordpress.com/2006/11/30/creating-a-data-access-layer-with-linq-to-sql-part-2/#comment-2256</guid>
		<description>This is what I was looking for. After 5 days of working with LINQ, I decided to move back to net tiers.</description>
		<content:encoded><![CDATA[<p>This is what I was looking for. After 5 days of working with LINQ, I decided to move back to net tiers.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
