Microsoft ADO.NET Entity Framework 4.1 Release
We are excited to announce that Microsoft ADO.NET Entity Framework 4.1 Release Candidate (EF 4.1 RC) is now available. This is a fully supported, go-live release. In approximately one month we plan to release the final Release to Web (RTW). We are not planning any changes to the API surface or behavior between RC and RTW, the release is purely to allow any new bugs found in the RC build to be evaluated and potentially fixed.
What’s in EF 4.1 RC?
ADO.NET Entity Framework 4.1 RC introduces two new features:
- The DbContext API is a simplified abstraction over ObjectContext and a number of other types that were included in previous releases of the ADO.NET Entity Framework. The DbContext API surface is optimized for common tasks and coding patterns. DbContext can be used with Database First, Model First and Code First development.
- Code First is a new development pattern for the ADO.NET Entity Framework and provides an alternative to the existing Database First and Model First patterns. Code First is focused around defining your model using C#/VB.NET classes, these classes can then be mapped to an existing database or be used to generate a database schema. Additional configuration can be supplied using Data Annotations or via a fluent API.
Getting EF 4.1 RC
ADO.NET Entity Framework 4.1 RC is available in a couple of places:
- Download the stand alone installer
- Add the ‘EntityFramework’ NuGet package to your project
Note: The NuGet package only includes the EF 4.1 runtime and does not include the Visual Studio item templates for using DbContext with Model First and Database First development.
There are a number of resources to help you get started with EF 4.1 RC:
- Beginners Guide to ADO.NET Entity Framework on the MSDN Data Developer Centre
Includes ‘Getting Started’ videos for the new features in EF 4.1
- ADO.NET Entity Framework Forum
- Code First walkthrough
- Model First / Database First walkthrough
- We will be releasing MSDN documentation for EF 4.1 shortly, we’ll announce this in a separate blog post once it is available
NuGet Package Rename
Previous releases of Code First were made available as the ‘EFCodeFirst’ NuGet package. The EF 4.1 RC release contains features that are also applicable to Model First and Database First development, therefore we have chosen to adopt the ‘EntityFramework’ package name for this release, and future releases. If you are currently using the ‘EFCodeFirst’ package you will need to swap to the ‘EntityFramework’ package to get the supported go-live release. If you own a package that depends on ‘EFCodeFirst’ we would encourage you to swap the dependency over to the ‘EntityFramework’ package as soon as possible.
This is a fully supported release. The ADO.NET Entity Framework Forum can be used for questions relating to this release. Further information about getting technical support can be found at the Microsoft Support website.
What Changed Since EF Feature CTP5?
The new features in ADO.NET Entity Framework 4.1 RC were previously included in Entity Framework Feature CTP5. The changes since Feature CTP5 include:
- Rename of ‘DbDatabase’ to ‘Database’. This class has also moved to the ‘System.Data.Entity’ namespace, along with the database initializer classes.
- Rename of ‘ModelBuilder’ to ‘DbModelBuilder’, to align with the other core classes.
- Validation in Model First and Database First. The new validation feature was only supported in Code First in CTP5. In RC the validation feature will work with all three development workflows (Model First, Database First, and Code First).
- Complete Intellisense docs. Feature CTPs were not extensively documented because the API surface was changing significantly between each release. This release includes complete documentation.
- Removal of Code First Pluggable Conventions. Pluggable Conventions were previewed in Feature CTP5 but were not at go-live quality for this release. This release still supports the removal of default conventions.
- Consolidation of IsIndependent in the Code First relationship API. When configuring relationships in Feature CTP5 the IsIndependent method was used to identify that the relationship did not have a foreign key property exposed in the object model. This is now done by calling the Map method. HasForeignKey is still used for relationships where the foreign key property is exposed in the object model.
What’s Not in EF 4.1?
There are a number of commonly requested features that did not make it into EF 4.1. We appreciate that these are really important to you and our team has started work on a number of them already, we will be reaching out for your feedback on these features soon:
- Enum support
- Spatial data type support
- Stored Procedure support in Code First
- Migration support in Code First
- Customizable conventions in Code First