In previous versions of EF the code was split between core libraries (primarily System.Data.Entity.dll) shipped as part of the .NET Framework and out-of-band (OOB) libraries (primarily EntityFramework.dll) shipped in a NuGet package. EF6 takes the code from the core libraries and incorporates it into the OOB libraries. This was necessary in order to allow EF to be made open source. The consequence of this is that applications will need to be rebuilt against the moved types.
This should be straightforward for applications that make use of DbContext as shipped in EF 4.1 and later. A little more work is required for applications that make use of ObjectContext but it still isn’t hard to do.
Here is a checklist of the things you need to do to upgrade an existing application to EF6.
Install the EF6 NuGet package |
|
You need to upgrade to the new Entity Framework 6 runtime.
Alternatively, you can run the following command from Package Manager Console: PM> Install-Package EntityFramework |
|
Ensure that assembly references to System.Data.Entity.dll are removed |
|
Installing the EF6 NuGet package should automatically remove any references to System.Data.Entity from your project for you. |
|
Swap any EF Designer (EDMX) models to use EF 6.x code generation |
|
If you have any models created with the EF Designer, you will need to update the code generation templates to generate EF6 compatible code. Note: There are currently only EF 6.x DbContext Generator templates available for Visual Studio 2012 and 2013.
|
|
Update namespaces for any core EF types being used |
|
The namespaces for DbContext and Code First types have not changed. This means for many applications that use EF 4.1 or later you will not need to change anything. Types like ObjectContext that were previously The
These types are in the Core
Note: |