jQuery Show Popup on Page Load

3 Sep 2012

Advantages and disadvantages of LINQ over Stored procedures

Below is the three advantages of LINQ over stored procedures. 

Debugging - As debug point concern, as LINQ is part of .NET, we can use the visual studio's debugger to debug the queries but it is tough to debug the Stored procedure as it will not support the visual studio debugger. 

Deployment - In case of deployment, we need to provide an additional script for stored procedures to execute but in case of LINQ, it will complie into single DLL hence deployment becomes easier. 

Type Safety - As LINQ is type safe, the queries errors are type checked at compile time. Better suggest to use LINQ because it helps to encounter an error at the compile time rather than at runtime exception.

The disadvantage with LINQ is, it is not a precompiled statement where as stored procedures are precompiled. In case of LINQ the queries need to be compile before the execution. So according to this, I can say stored procedures are faster in performance as compared to LINQ.


Linq Advantage and Disadvantage
LINQ (Language Integrated Query) is a Microsoft programming model and methodology that gives a formal query capabilities into Microsoft .NET-based programming languages.

It offers a compact, expressive, and intelligible syntax for manipulating data. The real value of LINQ comes is to apply the same query to an SQL database, a DataSet, an array of objects in memory and to many other types of data as well. It requires the presence of specific language extensions.

LINQ may be used to access all types of data, whereas embedded SQL is limited to addressing only databases that can handle SQL queries.

Below are the advantages and Disadvantages of LINQ

 It is a cleaner and typesafety.
It is checked by the compiler instead of at runtime
It can be debugged easily.
 It can be used against any datatype - it isn't limited to relational databases, you can also use it against XML, regular objects.
It can able to query not just tables in a relational database but also text files and XML files.


LINQ sends the entire query to the DB hence takes much network traffic but the stored procedures sends only argument and the stored procedure name. It will become really bad if the queries are very complex. 
Preformance is degraded if we don't write the linq query correctly.
If you need to make changes to the way you do data access, you need to recompile, version, and redeploy your assembly.


What are the advantages of LINQ in n-tier applications ?

1. Quick turn around for development
2. Queries can be dynamically
3. Tables are automatically created into class
4. Columns are automatically created into properties
5. Relationship are automatically appeaded to classes
6. Lambda expressions are awesome
7. Data is easy to setup and use
1. No clear outline for Tiers
2. No good way of view permissions
3. Small data sets will take longer to build the query than execute
4. There is an overhead for creating queries
5. When queries are moved from sql to application side, joins are very slow
DBML concurrency issues
6. Hard to understand advance queries using Expressions

No comments:

Post a Comment