Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ


Choose your language

InfoQ Homepage News Entity Framework 6 Brings Breaking Changes

Entity Framework 6 Brings Breaking Changes

When Entity Framework was first released it was considered to be part of the core .NET Framework. But since then Microsoft realized that EF wasn’t a complete product and needed to augment it with “out-of-band” releases. This created a split between the core classes in System.Data.Entity.dll and the out-of-band classes in EntityFramework.dll.

Since then Microsoft decided to move Entity Framework entirely into an open source model. This requires further reorganization, but with the added problem that the core files can’t simply disappear out of .NET 4.0. To address this, Microsoft is using a namespace switch. “The general rule for namespace changes is that any type in System.Data.* is moved to System.Data.Entity.Core.*.”

There are a few exceptions:

  • System.Data.EntityState => System.Data.Entity.EntityState
  • System.Data.Objects.DataClasses.EdmFunctionAttribute =>System.Data.Entity.DbFunctionAttribute (Note that the class has been renamed; a class with the old name still exists and works, but it now marked as obsolete.)
  • System.Data.Objects.EntityFunctions => System.Data.Entity.DbFunctions (Note that the class has been renamed; a class with the old name still exists and works, but it now marked as obsolete.)
  • Spatial classes (e.g. DbGeography, DbGeometry) have moved from System.Data.Spatial => System.Data.Entity.Spatial

Project member ajcvickers goes on to explain that EF-related classes in the System.Data namespace that are in System.Data.dll will not be changed.

Before you update the using statements in your project you’ll want to remove any references to System.Data.Entity.dll. Otherwise you could end up mixing old and new versions of Entity Framework.

It should also be noted that third-party providers for Entity Framework 5 are not be compatible with EF 6. So if you are not using SQL Server or SQL Server Compact Edition then you’ll need to have your providers updated. The changes appear to be rather minor, just basic stuff like overriding IsGeographyColumn and GetGeographyAsync.

Rate this Article