What’s in EF 4.1?
ADO.NET Entity Framework 4.1 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
ADO.NET Entity Framework 4.1 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:
- ADO.NET Entity Framework page on the MSDN Data Developer Center
There is lots of great new content on this site, including ‘Getting Started’ videos for the new features in EF 4.1
- MSDN Documentation
- ADO.NET Entity Framework Forum
- Code First walkthrough
- Model First / Database First walkthrough
This initial release only includes US English IntelliSense, exception messages and Visual Studio item templates. In approximately a month they will also be releasing a series of ‘Language Packs’ that will add localized versions of these resources to an existing EF 4.1 install. These language packs will be available for the same language set as Visual Studio 2010.
What Changed Since EF 4.1 Release Candidate?
The new features in ADO.NET Entity Framework 4.1 were previously available in a Release Candidate. The changes between RC and RTW are mostly bug fixes with one exception:
- Change of default length for non-key string and binary columns from ‘128’ to ‘Max’. SQL Compact does not support ‘Max’ columns, when running against SQL Compact an additional Code First convention will set a default length of 4000. There are more details about the change included in a recent blog post.
What’s Not in EF 4.1?
There are a number of commonly requested features that did not make it into EF 4.1. The ADO.NET Entity Framework Team appreciate that these are really important to you and their team has started work on a number of them already, they 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
Source: EF 4.1 Released