What's New in ADO.NET
The following features are new in ADO.NET with the .NET Framework version 4.
The Entity Framework decreases the amount of coding and maintenance required for data-driven applications by enabling you to program against data models defined in terms of entities and relationships. For more information, see Entity Framework Overview.
The features described below are new to the Entity Framework in .NET Framework 4.
Foreign Keys in the Conceptual Model
You can create conceptual models in which foreign key columns in the database correspond to scalar properties on entity types. For more information, see Defining and Managing Relationships.
Self-Tracking Entities for N-Tier Application Development
You can now use the self-tracking entities when working with N-tier applications. The self-tracking entities can record changes to scalar, complex, and navigation properties. The tracking information in self-tracking objects could be applied to the object context on the service side. For more information, see Working with Self-Tracking Entities.
New Methods for N-Tier Application Development
EntityDataSource Support for the QueryExtender Control
The EntityDataSource control now supports the QueryExtender control, which is used to create filters for data retrieved from a data source. For more information, see Applying LINQ Queries to EntityDataSource.
Testability with IObjectSet<T>
The ObjectContext class now returns typed ObjectSet<TEntity> objects that you can use to perform create, read, update, and delete operations on entity objects. The ObjectSet<TEntity> class implements the IObjectSet<TEntity> interface. The IObjectSet<TEntity> interface may be useful in testing scenarios. For more information, see Working with ObjectSet.
Direct Execution of Store Commands
You can use your own custom data classes together with your data model without making any modifications to the data classes themselves. This means that you can use "plain old" CLR objects (POCO), such as existing domain objects, with your Entity Framework application. For more information, see Persistence Ignorant Objects (Entity Framework).
Lazy Loading of Related Objects
With lazy loading, also known as deferred loading, related objects are automatically loaded from the data source when you access a navigation property. For more information, see Shaping Query Results (Entity Framework).
Functions in LINQ to Entities Queries
The EntityFunctions and SqlFunctions classes provide access to canonical and database functions from LINQ to Entities queries. The EdmFunctionAttribute allows a CLR method to serve as a proxy for a function defined in the conceptual model or storage model. For more information, see Calling Functions in LINQ to Entities Queries.
OrderBy Improvements in LINQ to Entities
LINQ to Entities queries that contain an OrderBy operator now return results ordered by the argument specified in the operator, regardless of the position of the operator in the query. However, the OrderBy operator in Entity SQL and ObjectQuery<T> queries is ignored if it is not the last operator in the query.
Customized Object-Layer Code Generation
The Generate Database Wizard enables you to do conceptual modeling first, and then create a database that supports the model. For more information, see How to: Generate a Database from a Conceptual Model.
Complex Type Support
The ADO.NET Entity Data Model Designer now supports complex types. For more information, see the following topics:
The Entity Data Model Wizard and the Update Model Wizard provide the option of using singular or plural forms of Entity, EntitySet, and NavigationProperty names to make application code more readable. For more information, see Choose Your Database Objects Dialog Box (Entity Data Model Wizard) and Choose Your Database Objects Dialog Box (Update Model Wizard).
Improved Model Browser Functionality
The Model Browser window of the ADO.NET Entity Data Model Designer enables you to delete objects from the storage model and to search the conceptual and storage models for a specified string. For more information, see Model Browser Window and How to: Delete Objects from the Storage Model.
Entity Designer Extensibility
You can extend the functionality of the ADO.NET Entity Data Model Tools by using classes in the namespace to write Visual Studio extensions. Classes in the namespace allow you to do the following:
Extend the .edmx file generation process.
Extend the .edmx file update process.
Load and save custom file formats.
Extend the .edmx file loading and saving processes.
For more information, see Extending the Entity Data Model Tools.
Entity Data Model Documentation
The documentation for the Entity Data Model has been updated. For more information, see Entity Data Model.