Communiquez avec les autres et partagez vos connaissances professionnelles

Inscrivez-vous ou connectez-vous pour rejoindre votre communauté professionnelle.

Suivre

How LINQ is beneficial than Stored Procedure ?

user-image
Question ajoutée par Utilisateur supprimé
Date de publication: 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.

More Questions Like This

Avez-vous besoin d'aide pour créer un CV ayant les mots-clés recherchés par les employeurs?