Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Dear DBA - I want to use LinqToSQL instead of stored procedures because

In my organization we have to answer to a separate DBA group for decisions like using LinqToSQL . What do you see as some of the best reasons for using L2S rather than stored procedures.

like image 553
jlembke Avatar asked Jul 08 '09 17:07

jlembke


2 Answers

The Stackoverflow question, Linq to SQL vs Stored Procedures?, has some good points for both sides.

Using stored procedures you get more tight control over your queries and when performance matters this can be a plus. You can also make changes to the procedures without needing to re-compile and re-deploy which can be handy.

However, using LINQ you get type-safety, your DAL is easier to keep versioned and maintained along with your project, it is easier to test and better debugging support.

like image 146
KingNestor Avatar answered Oct 07 '22 14:10

KingNestor


I think it boils down to code integration. Rather than having to look at stored procedures, you can simply look at the code in your application.

Take a look at this link... http://www.linqpad.net/WhyLINQBeatsSQL.aspx

I've also found the capability to build dynamic sql like LINQ queries to not appear so dynamic and rather easy to debug. For example, suppose that you have a search page with 10 different criteria/filters. If the user only filters on 2 of them, you can create an extension method to add a where filter on the query if some condition is true. If you had a sproc, you'd have a heap of a mess to debug...

like image 45
RSolberg Avatar answered Oct 07 '22 12:10

RSolberg