Chapter 29. The ADO.NET Entity Framework


  • Understanding the Entity Framework

  • Creating an Entity Framework model

  • Querying Entity Framework models

One of the core requirements in business applications (and many other types of applications) is the ability to store and retrieve data in a database. However, that's easier said than done, because the relational schema of a database does not blend well with the object hierarchies that we prefer to work with in code. To create and populate these object hierarchies required a lot of code to be written to transfer data from a data reader into a developer-friendly object model, which was then usually difficult to maintain. In fact, it was such a source of constant frustration that many developers turned to writing code generators or various other tools that automatically created the code to access a database based on its structure. However, code generators usually created a 1:1 mapping between the database structure and the object model, which was hardly ideal either, leading to a problem called "object relational impedance mismatch," where how data was stored in the database did not necessarily have a direct relationship with how developers wanted to model the data as objects. This led to the concept of Object Relational Mapping, where an ideal object model could be designed for working with data in code, which could then be mapped to the schema of a database. Once the mapping is complete, the Object Relational Mapper (ORM) ...

Get Professional Visual Studio® 2010 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.