Download as pdf or txt
Download as pdf or txt
You are on page 1of 3

1.Difference between LINQ and SQL S.No 1 2 LINQ LINQ Stands for language integrated query.

LINQ Statements are verified during compile time. To use LINQ we can depend upon our .Net Language syntaxes and also we can consume base class library functionalities. LINQ Statements can be debugged as they execute under framework environment. SQL . SQL SQL stands for Structured Query Language. SQL statements can be used in a application gets verified for their syntaxes only in the run time. To use SQL we need to be familiar with SQL syntaxes and also the predefined functions of SQL like MAX,MIN,LEN and SUBSTRING etc... As SQL statements execute on Database server debugging of the code is not possible.

2.Difference between LINQ to SQL and Entity Framework S.No 1 2 3 4 5 6 LINQ to SQL It only works with Sql server. Used for rapid application development. It does not support for complex type. It cannot generate db from model. Mapping type ( class to single table) We can query data using DataContext. Entity Framework It works with variety of db products. Cannot used for rapid application development. It provides support for complex type. It can generate db from model. Mapping type ( class to multiple tables) We can query data using esql,object services,entity client and linq to entities.

Another Good Reference: http://jinaldesai.net/linq-to-sql-vs-entity-framework/ (OR) http://www.slideshare.net/jinaldesailive/linq-to-sql-vs-entity-framework-jinal-desai

3.Difference between LINQ and Stored Procedures

S.No 1

LINQ As LINQ is part of .NET, we can use visual studios debugger to debug the queries With LINQ everything gets complied into single DLL hence deployment becomes easy. LINQ is type safe, so queries errors are type checked at compile time.It is really good to encounter an error when compiling rather than runtime exception! LINQ supports multiple databases LINQ supports abstraction which allows framework to add additional improvements like multi threading. It is much simpler and easier to add this support through LINQ than Stored Procedures.

Stored Procedures It is really very hard to debug the Stored Procedure With Stored Procedures, we need to provide an additional script for deployment Stored Procedures are not type safe i.e., error can be caught only during runtime.

4 5

With Stored Procedures which need to be re-written for different databases. As Stored Procedures does not support abstaction , so it is difficult to add additional impovements like multi threading

LINQ queries need to compile Stored Procedures are ster thn LINQ before execution.Therefore, LINQ because they are precompiled i.e., is slower than Stored Procedures. Stored Procedures have a predictable execution plan.Therefore, if a stored procedure is being executed for the second time, the database gets the cached execution plan to execute the stored procedure.

4.Difference between LINQ to SQL and LINQ to Objects

S.No 1

LINQ to SQL

LINQ to Objects

LINQ to SQL needs a Data LINQ to Objects does not need any Context object. The Data Context intermediate LINQ provider or API. object is the bridge between LINQ and the database. LINQ to SQL returns data of type IQueryable<T> LINQ to Objects returns data of type IEnumerable<T>.

LINQ to SQL is translated to SQL by way of Expression Trees, which allow them to be evaluated as a single unit and translated to the appropriate and optimal SQL statements. LINQ to SQL is translated to SQL calls and executed on the specified database

LINQ to Objects does not need to be translated.

LINQ to Objects is executed in the local machine memory.

5.Difference between LINQ to SQL and LINQ to Entities

S.No 1 2 3 4 5 6 7 8

LINQ to SQL
Does not support Conceptual Data Model Does not support Storage Schema Does not support Mapping Schema Does not support New Data Access Provider Does not support Non-SQL Server Database Support

LINQ to Entities
Supports Conceptual Data Model Supports Storage Schema Supports Mapping Schema Supports New Data Access Provider

Supports Non-SQL Server Database


Support Does not support Direct Database Connection

Supports Direct Database


Connection Does not support Multiple-table Inheritance Does not support Single Entity from Multiple Tables

Supports Multiple-table Inheritance Supports Single Entity from Multiple


Tables

You might also like