What is difference in Ado.net Entity Framewok and LINQ To SQL? - Online Free Computer Tutorials.

'Software Development, Games Development, Mobile Development, iOS Development, Android Development, Window Phone Development. Dot Net, Window Services,WCF Services, Web Services, MVC, MySQL, SQL Server and Oracle Tutorials, Articles and their Resources

Thursday, January 5, 2012

What is difference in Ado.net Entity Framewok and LINQ To SQL?

There are lot of things same but the difference are in how to use both in different scenarios.

L2S is tightly coupled - object property to specific field of database or more correctly object mapping to a specific database schema.  L2S supports a direct, 1:1 mapping of your existing database schema to classes; a single table can be mapped to a single inheritance hierarchy (i.e. , a table can contain persons, customers, and employees) and foreign keys can be exposed as strongly-typed relationships. L2S work only for SQL server.

A key design principle of L2S is that it "just work" for the common cases; so, for example, if you access a collection of orders through the Orders property of a customer, and that customer's orders have not previously been retrieved, L2S will automatically get them for you.

EF is loosely coupled, and may differ significantly, from your existing database schema. The EF supports model features like many-to-many relationships and inheritance. LINQ to SQL does not directly support these.

The Entity Framework lets you optionally represent many:many relationships directly, without representing the join table as an entity in your data model, and has a new feature called "Defining Query" that lets you expose any native query against the store as a "table" that can be mapped just as any other table

The Entity Framework works with Microsoft SQL Server and 3rd party databases through extended ADO.NET Data Providers, providing a common query language against different relational databases through either LINQ to Entities or Entity SQL.

So while there is a lot of overlap, LINQ to SQL is targeted more toward rapidly developingapplications against your existing Microsoft SQL Server schema, while the Entity Framework provides object- and storage-layer access to Microsoft SQL Server and 3rd party databases through a loosely coupled, flexible mapping to existing relational schema.

No comments:

Post a Comment