Wednesday 29 February 2012

Entity Framework

The Entity Framework provides a completely independent "conceptual model" of the data. When you use the Entity Framework, you code queries against this conceptual model and not against the actual data store. Entity Framework has its own dialect of SQL used to retrieve data called Entity SQL. It's not SQL Server's TSQL query language. In fact, the data store does not have to be a database.

The conceptual model contains what Microsoft calls "entities". The Entity Framework adds a layer of software to your application that maps the data from a data store to these entities. Of course, the data store still has to provide the data so the Entity Framework "conceptual model" has to be created and configured before it will work in your code.

LINQ to SQL gives you the ability to access a SQL Server data store using VB.NET/C# language elements.
LINQ to Entities gives you the abilty to access the Entity Framework model, which could potentially include data from any data store, using VB.NET/C# language elements.

Entity Framework can provide the many-to-many relationship in the data model automatically.

Install "Microsoft Visual Studio 2010 ADO.NET Entity Framework Tools"
Create the Entity Framework conceptual model
Right click on the project, select Add, New Item..., Data, ADO.NET Entity Data Model


Microsoft gives you two ways to access the data in the Entity Framework model:
  • LINQ to Entities
  • Entity SQL (A variant of the venerable SQL language just for the Entity Framework)
Since Entity Framework implements both IQueryable (used more in Entity Framework) and IEnumerable (used in LINQ), you actually get the advantages of both worlds.

more info...

No comments:

Post a Comment