.

Friday, July 29, 2011

Advantages and Disadvantages of LINQ

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.

.