Appendix A

ADO.NET Entity Framework

The ADO.NET Entity Framework is an object-relational mapping framework that is based on .NET 3.5. Chapter 27 demonstrated object-relational mapping with LINQ to SQL. LINQ to SQL offers simple mapping features for associations and inheritance. The ADO.NET Entity Framework gives you many more options for associations and inheritance. Another difference between LINQ to SQL and the ADO.NET Entity Framework is that the ADO.NET Entity Framework is a provider-based model that allows other database vendors to plug into it.

This appendix covers the following:

  • The ADO.NET Entity Framework
  • Entity Framework layers
  • Entities
  • Object contexts
  • Relationships
  • Object queries
  • Updates
  • LINQ to Entities

This appendix is based on the Beta 3 version of this framework, which is due to be released some months after the .NET 3.5 product, so some class or method names may be different than what you read here.

This appendix uses the Books, Formula1, and Northwind databases. You can download the Northwind database from; the Books and Formula1 databases are included with the download of the code samples.

Overview of the ADO.NET Entity Framework

The ADO.NET Entity Framework provides a mapping from the relational database schema to objects. Relational databases and object-oriented languages define associations differently. For example, the Microsoft sample database Northwind contains the Customers and Orders tables. To access all the Orders rows for a customer, ...

Get Professional C# 2008 now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.