.NET 4.5 Beta DbGeography NotImplementedException

DefaultSpatialServices in Entity Framework are using SqlGeography and SqlGeometry types as backing types. These two types live in Microsoft.SqlServer.Types.dll assembly that is not part of the .NET Framework. The exception is thrown when EF cannot find these types (the exception could be more helpful…). When you install Visual Studio it will install localdb on your machine (or you may already have a SqlExpress database) and this is probably the way how you got the type on the machine that is working. On a machine where there is only .NET Framework installed and not Sql Server you won’t have these types. You can either install SqlExpress on the box where you get the exception or you can try installing just the types. I am not sure where to get the assembly itself but I think the Sql Server feature pack (http://www.microsoft.com/en-us/download/details.aspx?id=27596) may have it. Types from SqlServer 2008 and SqlServer 2012 are supported so it should not matter which version you install.

EDIT

In EF6 the exception will contain a better message see: https://entityframework.codeplex.com/SourceControl/changeset/b3eca2c141c0fb517504f9731dc8ba7a9c5727ee

Work item used to track this bug: https://entityframework.codeplex.com/workitem/3

Leave a Comment