ابدأ بالتواصل مع الأشخاص وتبادل معارفك المهنية

أنشئ حسابًا أو سجّل الدخول للانضمام إلى مجتمعك المهني.

متابعة

How LINQ is beneficial than Stored Procedure ?

user-image
تم إضافة السؤال من قبل مستخدم محذوف‎
تاريخ النشر: 2016/02/18
مستخدم محذوف‎
من قبل مستخدم محذوف‎

LINQ has good advantage over stored procedures:

  • Debugging  :  Debugging the stored procedure is hard. With visual studio’s debugger we can easily debug LINQ queries.
  • Deployment  : LINQ deployment is easy. For SP we need to provide scripts but in LINQ everything’s gets compiled into a single DLL.
  • Type Safety  : LINQ is type safe. Errors are checked at compile time.

The query when executed against Sql Server, which in turn needs to generate an execution plan for the query and run it against the table to get the results. It's pretty efficient at creating the right query for the right job, and supports more of an ad-hoc approach to data querying.

With stored procedures, Linq-to-Sql doesn't have to generate an expression tree and from that generate the sql, instead the designer generated class has all in information it needs to pass the arguments from the method to the stored procedure.

 

In that sense, its more efficient to use stored procedures, but you lose the ability to do these ad-hoc queries which are so often useful.

المزيد من الأسئلة المماثلة

هل تحتاج لمساعدة في كتابة سيرة ذاتية تحتوي على الكلمات الدلالية التي يبحث عنها أصحاب العمل؟