Chapter 31. ADO.NET Entity Framework

WHAT'S IN THIS CHAPTER?

  • The ADO.NET Entity Framework

  • Mapping between database tables and entity classes

  • Creating entity classes and their features

  • Object contexts

  • Relationships

  • Object queries

  • Updates

  • LINQ to Entities

The ADO.NET Entity Framework is an object-relational mapping framework that offers an abstraction of ADO.NET to get an object model based on the referential databases. This chapter gives information on the mappings between the database and the entity classes using the Conceptual Schema Definition Language (CSDL), Storage Schema Definition Language (SSDL), and the Mapping Schema Language (MSL). Different relationships between entities are covered, such as one Table-per-Hierarchy of objects, one Table-per-Type, and n-to-n relationships.

This chapter also describes different ways to access the database from the code directly with the Entity Client, using Entity SQL or helper methods that create Entity SQL, and using LINQ to Entities. Object tracking and how the data context holds change information for updating data is also shown.

Note

This chapter uses the Books, Formula1, and Northwind databases. You can download the Northwind database from msdn.microsoft.com; the Books and Formula1 databases are included with the download of the code samples at http://www.wrox.com.

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 ...

Get Professional C# 4 and .NET 4 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.