Hello All, We are going to start new batch from next week. message/call or mail us for more details.

4 September 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


Advantages:
 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.

Disadvantages:

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 ?



Advantages
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
 
Disadvantages
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
 



9 comments:

  1. It might help you in detail,
    http://www.code-sample.com/2016/11/linq-advantages-and-disadvantages-in-net.html

    ReplyDelete
  2. Good information about . net. nice information. keep sharing ths type of information. Thanks for sharing


    dotnet Training in chennai

    ReplyDelete
  3. This comment has been removed by the author.

    ReplyDelete
  4. Thank you very much for sharing this information! It can help to raise awareness about the topic and to can get gather more feedbacks . To know more about asp.net development check out this article: https://goo.gl/PTp9dy

    ReplyDelete
  5. Good job with the article! You've given all the advantages and disadvantages that we need to know. LINQ offers a common syntax for querying any type of data sources and its expressions are Strongly Typed. With stored procedures, we need to provide an additional script for stored procedures but with LINQ everything gets complied into single DLL hence deployment becomes easy.

    ReplyDelete
  6. Good Post. I like your blog. Thanks for Sharing.....
    .NET Training In Noida

    ReplyDelete