<?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: LINQ to SQL Reality Check</title>
	<atom:link href="http://ajdotnet.wordpress.com/2008/04/20/linq-to-sql-reality-check/feed/" rel="self" type="application/rss+xml" />
	<link>http://ajdotnet.wordpress.com/2008/04/20/linq-to-sql-reality-check/</link>
	<description>Thoughts and informations I think worthwhile to share...</description>
	<lastBuildDate>Fri, 18 Sep 2009 01:42:12 +0000</lastBuildDate>
	<generator>http://wordpress.com/</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: kevinlawry</title>
		<link>http://ajdotnet.wordpress.com/2008/04/20/linq-to-sql-reality-check/#comment-8152</link>
		<dc:creator>kevinlawry</dc:creator>
		<pubDate>Fri, 20 Feb 2009 15:25:09 +0000</pubDate>
		<guid isPermaLink="false">http://ajdotnet.wordpress.com/?p=157#comment-8152</guid>
		<description>Hi AJ.  You wrote, &quot;In my opinion the biggest obstacle with LINQ to SQL is the fact that all code, entities and data context, are created in one big source file, thus I cannot separate them.&quot;

There is actually a great way to separate them without jumping through hoops.  I found a new code generation tool for LINQ-to-SQL that splits all of these parts into separate files which you could even put into separate assemblies AND you can still use the O/R Designer in VS2008 to make changes.  The code re-generation process preserves both the designer changes and your code changes.  It&#039;s pretty cool.  It&#039;s called PLINQO.  You can read more about it here:  http://kevinlawry.wordpress.com/2009/02/18/does-linq-stinq-not-with-plinqo/</description>
		<content:encoded><![CDATA[<p>Hi AJ.  You wrote, &#8220;In my opinion the biggest obstacle with LINQ to SQL is the fact that all code, entities and data context, are created in one big source file, thus I cannot separate them.&#8221;</p>
<p>There is actually a great way to separate them without jumping through hoops.  I found a new code generation tool for LINQ-to-SQL that splits all of these parts into separate files which you could even put into separate assemblies AND you can still use the O/R Designer in VS2008 to make changes.  The code re-generation process preserves both the designer changes and your code changes.  It&#8217;s pretty cool.  It&#8217;s called PLINQO.  You can read more about it here:  <a href="http://kevinlawry.wordpress.com/2009/02/18/does-linq-stinq-not-with-plinqo/" rel="nofollow">http://kevinlawry.wordpress.com/2009/02/18/does-linq-stinq-not-with-plinqo/</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Liam McLennan</title>
		<link>http://ajdotnet.wordpress.com/2008/04/20/linq-to-sql-reality-check/#comment-8089</link>
		<dc:creator>Liam McLennan</dc:creator>
		<pubDate>Mon, 09 Jun 2008 10:11:11 +0000</pubDate>
		<guid isPermaLink="false">http://ajdotnet.wordpress.com/?p=157#comment-8089</guid>
		<description>&quot;In my opinion the biggest obstacle with LINQ to SQL is the fact that all code, entities and data context, are created in one big source file, thus I cannot separate them&quot;

This is not true. The VS designer tool, and the corresponding command line tool Sql metal, do behave in the way you described. But there is nothing about Linq-to-sql that requires it to be this way. You can use your own persistence ignorant classes if you want. Alternatively, you can leave all the classes in the one generated file and then use partial classes to add behaviour to them. This is not a disadvantage since the classes are codegened, so having them generated into seperate files would not make them editable. 

I too have had trouble trying to get the datacontext into a different assembly from the entities. However, once again I believe it is possible if you are prepared to walk away from the Linq-to-sql codegen tools.</description>
		<content:encoded><![CDATA[<p>&#8220;In my opinion the biggest obstacle with LINQ to SQL is the fact that all code, entities and data context, are created in one big source file, thus I cannot separate them&#8221;</p>
<p>This is not true. The VS designer tool, and the corresponding command line tool Sql metal, do behave in the way you described. But there is nothing about Linq-to-sql that requires it to be this way. You can use your own persistence ignorant classes if you want. Alternatively, you can leave all the classes in the one generated file and then use partial classes to add behaviour to them. This is not a disadvantage since the classes are codegened, so having them generated into seperate files would not make them editable. </p>
<p>I too have had trouble trying to get the datacontext into a different assembly from the entities. However, once again I believe it is possible if you are prepared to walk away from the Linq-to-sql codegen tools.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: instantcode</title>
		<link>http://ajdotnet.wordpress.com/2008/04/20/linq-to-sql-reality-check/#comment-8088</link>
		<dc:creator>instantcode</dc:creator>
		<pubDate>Wed, 28 May 2008 05:40:04 +0000</pubDate>
		<guid isPermaLink="false">http://ajdotnet.wordpress.com/?p=157#comment-8088</guid>
		<description>Great post on LINQ to SQL. I find LINQ to SQL is surely a better way than old code. But I have been using a product called &lt;a href=&quot;http://www.akaltech.com/Products/Default.aspx&quot; rel=&quot;nofollow&quot;&gt;Quick Objects&lt;/a&gt; and the code above that shows mapping I can write like below.

Customer FindCustomer(int mainAccount)
{
   using (Customer c = new Customer())
   {
      c.ObjectMode = ObjectModes.Search;
      c.MainAccount.Value = mainAccount;
      c.SetVisibleFields(c.ID, c.Name, c.TotalBalance);
      c.FindAndLoad();
      return c;
   }
}

Best of all I could have added bunch of joins, sorting or added server side paging with the same kind of ease. I know Quick Objects guys are working on LINQ support and I am really looking forward to that. I haven&#039;t tried ADO.NET Entity Framework yet but I can already do most of the stuff using Quick Objects very easily.

I am hoping soon I&#039;ll review the Entity Framework soon.</description>
		<content:encoded><![CDATA[<p>Great post on LINQ to SQL. I find LINQ to SQL is surely a better way than old code. But I have been using a product called <a href="http://www.akaltech.com/Products/Default.aspx" rel="nofollow">Quick Objects</a> and the code above that shows mapping I can write like below.</p>
<p>Customer FindCustomer(int mainAccount)<br />
{<br />
   using (Customer c = new Customer())<br />
   {<br />
      c.ObjectMode = ObjectModes.Search;<br />
      c.MainAccount.Value = mainAccount;<br />
      c.SetVisibleFields(c.ID, c.Name, c.TotalBalance);<br />
      c.FindAndLoad();<br />
      return c;<br />
   }<br />
}</p>
<p>Best of all I could have added bunch of joins, sorting or added server side paging with the same kind of ease. I know Quick Objects guys are working on LINQ support and I am really looking forward to that. I haven&#8217;t tried ADO.NET Entity Framework yet but I can already do most of the stuff using Quick Objects very easily.</p>
<p>I am hoping soon I&#8217;ll review the Entity Framework soon.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Brian</title>
		<link>http://ajdotnet.wordpress.com/2008/04/20/linq-to-sql-reality-check/#comment-8071</link>
		<dc:creator>Brian</dc:creator>
		<pubDate>Tue, 22 Apr 2008 13:54:06 +0000</pubDate>
		<guid isPermaLink="false">http://ajdotnet.wordpress.com/?p=157#comment-8071</guid>
		<description>LINQ to SQL is explicitly targetted as a &quot;quick (and dirty)&quot; solution by Microsoft. It is sort of the successor to using datasets, the former &quot;shotgun&quot; approach (you always end up hitting something). 

Though I like LINQ to SQL much more than DataSets from what I have seen so far. And when using LINQ to SQL, you still can&#039;t turn off your brain.

If you are talking &quot;architecture&quot;, services, abstraction and thelike, take a look at the ADO.NET Entity Framework, which is meant to be a full blown solution with much greater capabilities.</description>
		<content:encoded><![CDATA[<p>LINQ to SQL is explicitly targetted as a &#8220;quick (and dirty)&#8221; solution by Microsoft. It is sort of the successor to using datasets, the former &#8220;shotgun&#8221; approach (you always end up hitting something). </p>
<p>Though I like LINQ to SQL much more than DataSets from what I have seen so far. And when using LINQ to SQL, you still can&#8217;t turn off your brain.</p>
<p>If you are talking &#8220;architecture&#8221;, services, abstraction and thelike, take a look at the ADO.NET Entity Framework, which is meant to be a full blown solution with much greater capabilities.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: ajdotnet</title>
		<link>http://ajdotnet.wordpress.com/2008/04/20/linq-to-sql-reality-check/#comment-8069</link>
		<dc:creator>ajdotnet</dc:creator>
		<pubDate>Tue, 22 Apr 2008 05:19:23 +0000</pubDate>
		<guid isPermaLink="false">http://ajdotnet.wordpress.com/?p=157#comment-8069</guid>
		<description>@JV: The introduction in the previous post said &quot;I kind of need it as introduction to some other posts I have in mind.&quot; Guess what they will be about...

@tirat: &quot;Real&quot; real old code (if I had written it) would certainly not concat SQL statements with &#039;+&#039;, neither would it hardcode a dependecy between a SQL string and another pice of code like the indexed field access does. It would probably look like that:

Customer FindCustomer(int mainAccount)
{
     using (DBHelper db = DBHelper.OpenConnection())
     {
	return db.ReadSingleRow(SELECT_CUSTOMER_BY_ACCOUNT, “MainAccount”, mainAccount);
     }
}

Neat?

AJ.NET</description>
		<content:encoded><![CDATA[<p>@JV: The introduction in the previous post said &#8220;I kind of need it as introduction to some other posts I have in mind.&#8221; Guess what they will be about&#8230;</p>
<p>@tirat: &#8220;Real&#8221; real old code (if I had written it) would certainly not concat SQL statements with &#8216;+&#8217;, neither would it hardcode a dependecy between a SQL string and another pice of code like the indexed field access does. It would probably look like that:</p>
<p>Customer FindCustomer(int mainAccount)<br />
{<br />
     using (DBHelper db = DBHelper.OpenConnection())<br />
     {<br />
	return db.ReadSingleRow(SELECT_CUSTOMER_BY_ACCOUNT, “MainAccount”, mainAccount);<br />
     }<br />
}</p>
<p>Neat?</p>
<p>AJ.NET</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: titrat</title>
		<link>http://ajdotnet.wordpress.com/2008/04/20/linq-to-sql-reality-check/#comment-8062</link>
		<dc:creator>titrat</dc:creator>
		<pubDate>Mon, 21 Apr 2008 16:09:48 +0000</pubDate>
		<guid isPermaLink="false">http://ajdotnet.wordpress.com/?p=157#comment-8062</guid>
		<description>&quot;Real&quot; old code would look a little neater with some helper-functions:

Customer FindCustomer(System.Data.IDbConnection voConn, int mainAccount)
{
	Customer c = null;
	string lsSql = &quot;SELECT id, mainaccount, name FROM tabAccount WHERE id = &quot; + mainAccount;
	SqlDataReader rst = clsSql.ExecuteReader(voConn, lsSql);
	if (!rst.Read())
	{
		c.Id = rst.GetInt32(0);
		c.MainAccount = rst.GetInt32(1);
		c.Name = rst.GetString(2);
	}
	rst.Close();
	return c;
 }</description>
		<content:encoded><![CDATA[<p>&#8220;Real&#8221; old code would look a little neater with some helper-functions:</p>
<p>Customer FindCustomer(System.Data.IDbConnection voConn, int mainAccount)<br />
{<br />
	Customer c = null;<br />
	string lsSql = &#8220;SELECT id, mainaccount, name FROM tabAccount WHERE id = &#8221; + mainAccount;<br />
	SqlDataReader rst = clsSql.ExecuteReader(voConn, lsSql);<br />
	if (!rst.Read())<br />
	{<br />
		c.Id = rst.GetInt32(0);<br />
		c.MainAccount = rst.GetInt32(1);<br />
		c.Name = rst.GetString(2);<br />
	}<br />
	rst.Close();<br />
	return c;<br />
 }</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: JV</title>
		<link>http://ajdotnet.wordpress.com/2008/04/20/linq-to-sql-reality-check/#comment-8061</link>
		<dc:creator>JV</dc:creator>
		<pubDate>Mon, 21 Apr 2008 12:36:24 +0000</pubDate>
		<guid isPermaLink="false">http://ajdotnet.wordpress.com/?p=157#comment-8061</guid>
		<description>It would be nicer if you would have also incorperated abit more of the comparision with a layered architecture, instead of those 5 lines (Although you do nail it there). In general LINQ is great, but we&#039;ll still have to find a proper place for it in our architectures...</description>
		<content:encoded><![CDATA[<p>It would be nicer if you would have also incorperated abit more of the comparision with a layered architecture, instead of those 5 lines (Although you do nail it there). In general LINQ is great, but we&#8217;ll still have to find a proper place for it in our architectures&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Kris Vandermotten</title>
		<link>http://ajdotnet.wordpress.com/2008/04/20/linq-to-sql-reality-check/#comment-8059</link>
		<dc:creator>Kris Vandermotten</dc:creator>
		<pubDate>Sun, 20 Apr 2008 19:00:10 +0000</pubDate>
		<guid isPermaLink="false">http://ajdotnet.wordpress.com/?p=157#comment-8059</guid>
		<description>In fact, you can (and should) do your &quot;mapping&quot; (projection) in the select operator:

Customer FindCustomerLinq2(int mainAccount)
{
     DataClassesDataContext dc = new DataClassesDataContext();
     return (from cc in dc.CustomerLinqs 
             where cc.MainAccount == mainAccount 
             select new Customer() 
             {
                 Id = cc.ID, 
                 MainAccount = cc.MainAccount, 
                 Name = cc.Name, 
                 TotalBalance = cc.TotalBalance 
             }).FirstOrDefault();
}</description>
		<content:encoded><![CDATA[<p>In fact, you can (and should) do your &#8220;mapping&#8221; (projection) in the select operator:</p>
<p>Customer FindCustomerLinq2(int mainAccount)<br />
{<br />
     DataClassesDataContext dc = new DataClassesDataContext();<br />
     return (from cc in dc.CustomerLinqs<br />
             where cc.MainAccount == mainAccount<br />
             select new Customer()<br />
             {<br />
                 Id = cc.ID,<br />
                 MainAccount = cc.MainAccount,<br />
                 Name = cc.Name,<br />
                 TotalBalance = cc.TotalBalance<br />
             }).FirstOrDefault();<br />
}</p>
]]></content:encoded>
	</item>
</channel>
</rss>
