<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/'><id>tag:blogger.com,1999:blog-4214922889450630344.post892965719237419004..comments</id><updated>2008-06-23T10:02:36.940-07:00</updated><category term='Personal'/><category term='SharePoint'/><category term='WF'/><category term='Visual Studio'/><category term='Asp.net'/><category term='ReSharper'/><category term='Alt.net'/><category term='IoC'/><category term='IIS'/><category term='Linq'/><category term='Databinding'/><category term='Software Development'/><title type='text'>Comments on Robin Clowers: Stored Procedures, a Best Practice?</title><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://blog.robinclowers.com/feeds/892965719237419004/comments/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4214922889450630344/892965719237419004/comments/default'/><link rel='alternate' type='text/html' href='http://blog.robinclowers.com/2008/06/stored-procedures-best-practice.html'/><author><name>Robin Clowers</name><uri>http://www.blogger.com/profile/09558658468617627887</uri><email>noreply@blogger.com</email><gd:image xmlns:gd='http://schemas.google.com/g/2005' rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>2</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-4214922889450630344.post-2421048445649740232</id><published>2008-06-23T10:02:00.000-07:00</published><updated>2008-06-23T10:02:00.000-07:00</updated><title type='text'>Hi again merlin, it seems like you may be misunder...</title><content type='html'>Hi again merlin, it seems like you may be misunderstanding how Linq to Sql uses deferred execution, so I posted an &lt;A HREF="http://robinclowers.blogspot.com/2008/06/deferred-execution-in-linq-to-sql.html" REL="nofollow"&gt;explaination&lt;/A&gt; of it.</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4214922889450630344/892965719237419004/comments/default/2421048445649740232'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4214922889450630344/892965719237419004/comments/default/2421048445649740232'/><link rel='alternate' type='text/html' href='http://blog.robinclowers.com/2008/06/stored-procedures-best-practice.html?showComment=1214240520000#c2421048445649740232' title=''/><author><name>Robin Clowers</name><uri>http://www.blogger.com/profile/09558658468617627887</uri><email>noreply@blogger.com</email><gd:image xmlns:gd='http://schemas.google.com/g/2005' rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://blog.robinclowers.com/2008/06/stored-procedures-best-practice.html' ref='tag:blogger.com,1999:blog-4214922889450630344.post-892965719237419004' source='http://www.blogger.com/feeds/4214922889450630344/posts/default/892965719237419004' type='text/html'/><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='blogger.itemClass' value='pid-338536435'/></entry><entry><id>tag:blogger.com,1999:blog-4214922889450630344.post-9215276317007803827</id><published>2008-06-10T02:35:00.000-07:00</published><updated>2008-06-10T02:35:00.000-07:00</updated><title type='text'>Thank you for the response. I concede you are corr...</title><content type='html'>Thank you for the response. I concede you are correct that stored procedures are not pre-compiled in SQL Server 2000 and 2005. This is definitely an under-discussed change from previous versions.&lt;BR/&gt;&lt;BR/&gt;However, I do still believe stored procedures are better, if for no other reason than security. First, for the added layer of security from SQL injection attacks. Second, from the added layer of internal security (you can grant execute permission to the IIS user for stored procedures, but deny execute/insert/delete on all other SQL commands).&lt;BR/&gt;&lt;BR/&gt;Regarding deferred execution, I can see it as a good thing in a limited number of scenarios. The problem with deferred execution is that developers (especially ones new to LINQ), are accustomed to knowing that when they have a List or other IENumerable/IQueryable object, the data is already there. However, with deferred execution, the data is not "there" until you request that particular element. Also, especially with SQL, the element can change before you make the request for it.&lt;BR/&gt;&lt;BR/&gt;The majority of the time, the developer wants (and probably needs) the data to be there immediately. Without properly understanding deferred execution, the developer could think that his IQueryable object is fully populated, when it is not.&lt;BR/&gt;&lt;BR/&gt;There is also a performance penalty, in my opinion, for deferred execution on LINQ to SQL. The problem comes when you iterate through the list; you are constantly querying the database. Constantly requesting one row at a time can have serious consequences on a production database that services several hundred users per minute. This is another advantage of stored procedures (for LINQ to SQL), because the sproc forces the database to return all the data back to LINQ immediately. In this way, regardless of deferred execution, the developer can be assured that a) he/she has only queried the database once, and b) all the data is available and will &lt;B&gt;not&lt;/B&gt; change during the iteration of the data.&lt;BR/&gt;&lt;BR/&gt;Thank you for this interesting conversation, Robin. The research was fun and educational.</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4214922889450630344/892965719237419004/comments/default/9215276317007803827'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4214922889450630344/892965719237419004/comments/default/9215276317007803827'/><link rel='alternate' type='text/html' href='http://blog.robinclowers.com/2008/06/stored-procedures-best-practice.html?showComment=1213090500000#c9215276317007803827' title=''/><author><name>merlin981</name><uri>http://www.blogger.com/profile/05516602905783627586</uri><email>noreply@blogger.com</email><gd:image xmlns:gd='http://schemas.google.com/g/2005' rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://blog.robinclowers.com/2008/06/stored-procedures-best-practice.html' ref='tag:blogger.com,1999:blog-4214922889450630344.post-892965719237419004' source='http://www.blogger.com/feeds/4214922889450630344/posts/default/892965719237419004' type='text/html'/><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='blogger.itemClass' value='pid-288537241'/></entry></feed>
