<?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/"
		>
<channel>
	<title>Comments for BinzBlog - Robert Binzley : robert@binzley.net</title>
	<atom:link href="http://www.binzley.net/?feed=comments-rss2" rel="self" type="application/rss+xml" />
	<link>http://www.binzley.net</link>
	<description>Musings on pragmatic .net solution development.</description>
	<lastBuildDate>Sat, 21 Aug 2010 14:10:15 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>Comment on Why ORM Should Be Used, At Least Most Of TheTime by Robert Binzley</title>
		<link>http://www.binzley.net/?p=464&#038;cpage=1#comment-1067</link>
		<dc:creator>Robert Binzley</dc:creator>
		<pubDate>Sat, 21 Aug 2010 14:10:15 +0000</pubDate>
		<guid isPermaLink="false">http://www.binzley.net/?p=464#comment-1067</guid>
		<description>Hello and thanks for taking time to comment on this post!

I agree if you want absolute peak performance and you have the resources and expertise you should go the direct SQL route.  Also, I should probably have said a mixture of ORM and direct SQL is probably the best approach as most applications probably have some functionality that is similar to reporting and will require several data processing steps that are best handled in a stored procedure.  That said, for basic CRUD and filtering operations I would still advocate an ORM tool unless peak performance is the top requirement.  Also in a mixed situation, I&#039;d probably use the ORM tool as the structure to call and pass parameters to the stored procedure or to pass my straight SQL as many ORM tools have this functionality.

The mass update is an interesting task and how it is handled depends on the ORM tool .  I think entity framework doesn&#039;t handle it at all.  Generally Entity Framework is a step behind in the ORM world. I came across a post indicating you can extend EF 4 to handle mass udpates, (http://geeks.ms/blogs/unai/archive/2008/07/17/multiple-entity-updates-with-entity-framework-ef-fetch-updates.aspx), but it doesn&#039;t handle it natively.  EF and nHinbernate create a session context and manage entity changes in memory until you tell the context to save to the database.  LLBL Gen can also manage objects in a context and only write changes back to the db when told to, but it&#039;s not it&#039;s default mode of operation.

LLBL gen pro has handled multiple entity updates for a long time.  It allows you to create a template entity that shows the values that should be set, and then define a predicate that defines what entities the the template changes should be applied to.   Here&#039;s an overly simple and unreal example. 

///--update all persons in db who have city &quot;Toledo&quot; to &quot;Cleveland&quot;

PersonEntity  personTemplate = new PersonEntity();
personTemplate.City = &quot;Cleveland&quot;

RelationPredicateBucket predicate= new RelationPredicateBucket();
predicate.PredicateExpression.Add(PersonFields.City == &quot;Toledo&quot;);

DataAccessAdapter adapter = new DataAccessAdapter();
int numberUpdated = adapter.UpdateEntitiesDirectly(personTemplate, predicate);

//----

I&#039;ve used LLBL myself for years because EF and it predecessors have been missing functionality like this.  Here&#039;s a link to more info about the LLBL gen updating. (http://www.llblgen.com/documentation/2.6/Using%20the%20generated%20code/Adapter/gencode_usingentityclasses_adapter.htm#Modifyinganentity)  and (http://www.llblgen.com/documentation/)

I  think amount of code needed to accomplish a task is a somewhat useful metric for effort, but I would probably use code smith to generate code for the direct SQL approach in simple cases anyway,  what would you suggest as a better proxy for time/effort required in creating a data access solution?

Thanks again for your comment!</description>
		<content:encoded><![CDATA[<p>Hello and thanks for taking time to comment on this post!</p>
<p>I agree if you want absolute peak performance and you have the resources and expertise you should go the direct SQL route.  Also, I should probably have said a mixture of ORM and direct SQL is probably the best approach as most applications probably have some functionality that is similar to reporting and will require several data processing steps that are best handled in a stored procedure.  That said, for basic CRUD and filtering operations I would still advocate an ORM tool unless peak performance is the top requirement.  Also in a mixed situation, I&#8217;d probably use the ORM tool as the structure to call and pass parameters to the stored procedure or to pass my straight SQL as many ORM tools have this functionality.</p>
<p>The mass update is an interesting task and how it is handled depends on the ORM tool .  I think entity framework doesn&#8217;t handle it at all.  Generally Entity Framework is a step behind in the ORM world. I came across a post indicating you can extend EF 4 to handle mass udpates, (<a href="http://geeks.ms/blogs/unai/archive/2008/07/17/multiple-entity-updates-with-entity-framework-ef-fetch-updates.aspx" rel="nofollow">http://geeks.ms/blogs/unai/archive/2008/07/17/multiple-entity-updates-with-entity-framework-ef-fetch-updates.aspx</a>), but it doesn&#8217;t handle it natively.  EF and nHinbernate create a session context and manage entity changes in memory until you tell the context to save to the database.  LLBL Gen can also manage objects in a context and only write changes back to the db when told to, but it&#8217;s not it&#8217;s default mode of operation.</p>
<p>LLBL gen pro has handled multiple entity updates for a long time.  It allows you to create a template entity that shows the values that should be set, and then define a predicate that defines what entities the the template changes should be applied to.   Here&#8217;s an overly simple and unreal example. </p>
<p>///&#8211;update all persons in db who have city &#8220;Toledo&#8221; to &#8220;Cleveland&#8221;</p>
<p>PersonEntity  personTemplate = new PersonEntity();<br />
personTemplate.City = &#8220;Cleveland&#8221;</p>
<p>RelationPredicateBucket predicate= new RelationPredicateBucket();<br />
predicate.PredicateExpression.Add(PersonFields.City == &#8220;Toledo&#8221;);</p>
<p>DataAccessAdapter adapter = new DataAccessAdapter();<br />
int numberUpdated = adapter.UpdateEntitiesDirectly(personTemplate, predicate);</p>
<p>//&#8212;-</p>
<p>I&#8217;ve used LLBL myself for years because EF and it predecessors have been missing functionality like this.  Here&#8217;s a link to more info about the LLBL gen updating. (<a href="http://www.llblgen.com/documentation/2.6/Using%20the%20generated%20code/Adapter/gencode_usingentityclasses_adapter.htm#Modifyinganentity" rel="nofollow">http://www.llblgen.com/documentation/2.6/Using%20the%20generated%20code/Adapter/gencode_usingentityclasses_adapter.htm#Modifyinganentity</a>)  and (<a href="http://www.llblgen.com/documentation/" rel="nofollow">http://www.llblgen.com/documentation/</a>)</p>
<p>I  think amount of code needed to accomplish a task is a somewhat useful metric for effort, but I would probably use code smith to generate code for the direct SQL approach in simple cases anyway,  what would you suggest as a better proxy for time/effort required in creating a data access solution?</p>
<p>Thanks again for your comment!</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Why ORM Should Be Used, At Least Most Of TheTime by Jonathan Wood</title>
		<link>http://www.binzley.net/?p=464&#038;cpage=1#comment-1063</link>
		<dc:creator>Jonathan Wood</dc:creator>
		<pubDate>Wed, 18 Aug 2010 16:00:44 +0000</pubDate>
		<guid isPermaLink="false">http://www.binzley.net/?p=464#comment-1063</guid>
		<description>As you say, there are multiple ways to approach this. I am currently struggling with when to use EF/LINQ, and when to use SQL, which has worked just fine for me in the past.

However, putting aside the fact that I have created my own database class that substantially reduces the amount of code needed for direct SQL, I think it is a mistake to present a discussion like this and only look at the amount of code needed while completely ignoring the efficiency of the resulting code.

In this particular example, EF is probably a good choice because selecting rows into a List of data types is what EF does well. However, even in this case, all tests I&#039;ve seen show that straight SQL will tend to be faster.

What about tasks like &quot;UPDATE MyTable SET Downloads = Downloads + 1 WHERE ID=@ID&quot;? EF/LINQ is simply a hindrance for such tasks.

Yes, EF and LINQ can be a useful tool for the developer. But I think the question about when to use them or direct SQL is a little more complex that this post suggests.</description>
		<content:encoded><![CDATA[<p>As you say, there are multiple ways to approach this. I am currently struggling with when to use EF/LINQ, and when to use SQL, which has worked just fine for me in the past.</p>
<p>However, putting aside the fact that I have created my own database class that substantially reduces the amount of code needed for direct SQL, I think it is a mistake to present a discussion like this and only look at the amount of code needed while completely ignoring the efficiency of the resulting code.</p>
<p>In this particular example, EF is probably a good choice because selecting rows into a List of data types is what EF does well. However, even in this case, all tests I&#8217;ve seen show that straight SQL will tend to be faster.</p>
<p>What about tasks like &#8220;UPDATE MyTable SET Downloads = Downloads + 1 WHERE ID=@ID&#8221;? EF/LINQ is simply a hindrance for such tasks.</p>
<p>Yes, EF and LINQ can be a useful tool for the developer. But I think the question about when to use them or direct SQL is a little more complex that this post suggests.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on CodeMash &#8211; Practical B/TDD by BinzBlog &#187; CodeMash 2010 Wrap UP</title>
		<link>http://www.binzley.net/?p=266&#038;cpage=1#comment-79</link>
		<dc:creator>BinzBlog &#187; CodeMash 2010 Wrap UP</dc:creator>
		<pubDate>Mon, 18 Jan 2010 23:24:13 +0000</pubDate>
		<guid isPermaLink="false">http://www.binzley.net/?p=266#comment-79</guid>
		<description>[...] Practical B/TDD [...]</description>
		<content:encoded><![CDATA[<p>[...] Practical B/TDD [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on CodeMash &#8211; Iteration 0 by BinzBlog &#187; CodeMash 2010 Wrap UP</title>
		<link>http://www.binzley.net/?p=288&#038;cpage=1#comment-78</link>
		<dc:creator>BinzBlog &#187; CodeMash 2010 Wrap UP</dc:creator>
		<pubDate>Mon, 18 Jan 2010 23:22:47 +0000</pubDate>
		<guid isPermaLink="false">http://www.binzley.net/?p=288#comment-78</guid>
		<description>[...] Agile &#8211; Iteration Zero [...]</description>
		<content:encoded><![CDATA[<p>[...] Agile &#8211; Iteration Zero [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on CodeMash &#8211; Keynote by BinzBlog &#187; CodeMash 2010 Wrap UP</title>
		<link>http://www.binzley.net/?p=305&#038;cpage=1#comment-77</link>
		<dc:creator>BinzBlog &#187; CodeMash 2010 Wrap UP</dc:creator>
		<pubDate>Mon, 18 Jan 2010 20:27:59 +0000</pubDate>
		<guid isPermaLink="false">http://www.binzley.net/?p=305#comment-77</guid>
		<description>[...] Keynote &#8211; Lean Methodology [...]</description>
		<content:encoded><![CDATA[<p>[...] Keynote &#8211; Lean Methodology [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on CodeMash &#8211; User Stories Closing The Agile Loop by BinzBlog &#187; CodeMash 2010 Wrap UP</title>
		<link>http://www.binzley.net/?p=311&#038;cpage=1#comment-76</link>
		<dc:creator>BinzBlog &#187; CodeMash 2010 Wrap UP</dc:creator>
		<pubDate>Mon, 18 Jan 2010 17:35:11 +0000</pubDate>
		<guid isPermaLink="false">http://www.binzley.net/?p=311#comment-76</guid>
		<description>[...] User Stories Closing The Agile Loop [...]</description>
		<content:encoded><![CDATA[<p>[...] User Stories Closing The Agile Loop [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on CodeMash &#8211; Software Design and Testablity by BinzBlog &#187; CodeMash 2010 Wrap UP</title>
		<link>http://www.binzley.net/?p=330&#038;cpage=1#comment-75</link>
		<dc:creator>BinzBlog &#187; CodeMash 2010 Wrap UP</dc:creator>
		<pubDate>Mon, 18 Jan 2010 17:34:07 +0000</pubDate>
		<guid isPermaLink="false">http://www.binzley.net/?p=330#comment-75</guid>
		<description>[...] Software Design and Testablity [...]</description>
		<content:encoded><![CDATA[<p>[...] Software Design and Testablity [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on CodeMash &#8211; Domain Driven Design by BinzBlog &#187; CodeMash 2010 Wrap UP</title>
		<link>http://www.binzley.net/?p=356&#038;cpage=1#comment-74</link>
		<dc:creator>BinzBlog &#187; CodeMash 2010 Wrap UP</dc:creator>
		<pubDate>Mon, 18 Jan 2010 17:33:06 +0000</pubDate>
		<guid isPermaLink="false">http://www.binzley.net/?p=356#comment-74</guid>
		<description>[...] Domain Driven Design [...]</description>
		<content:encoded><![CDATA[<p>[...] Domain Driven Design [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on CodeMash &#8211; Engineering Vs Design by BinzBlog &#187; CodeMash 2010 Wrap UP</title>
		<link>http://www.binzley.net/?p=359&#038;cpage=1#comment-73</link>
		<dc:creator>BinzBlog &#187; CodeMash 2010 Wrap UP</dc:creator>
		<pubDate>Mon, 18 Jan 2010 17:31:54 +0000</pubDate>
		<guid isPermaLink="false">http://www.binzley.net/?p=359#comment-73</guid>
		<description>[...] Engineering Vs Design [...]</description>
		<content:encoded><![CDATA[<p>[...] Engineering Vs Design [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on SOLID Principles by BinzBlog &#187; Code Mash Fundamentals Of Software Engineering</title>
		<link>http://www.binzley.net/?page_id=81&#038;cpage=1#comment-69</link>
		<dc:creator>BinzBlog &#187; Code Mash Fundamentals Of Software Engineering</dc:creator>
		<pubDate>Wed, 13 Jan 2010 14:33:29 +0000</pubDate>
		<guid isPermaLink="false">http://www.binzley.net/?page_id=81#comment-69</guid>
		<description>[...] SOLID Principles [...]</description>
		<content:encoded><![CDATA[<p>[...] SOLID Principles [...]</p>
]]></content:encoded>
	</item>
</channel>
</rss>
