Support for spatial types was introduced in EF5. However, in EF5 spatial types are only supported when the application targets and runs on .NET 4.5.
Starting with EF6 spatial types are supported for applications targeting both .NET 4 and .NET 4.5.
the Microsoft SQL Server provider depends on some additional low-level libraries that may need to be installed.
Prerequisites for spatial types with Microsoft SQL Server
SQL Server spatial support depends on the low-level, SQL Server-specific types SqlGeography
and SqlGeometry
. These types live in Microsoft.SqlServer.Types.dll
assembly, and this assembly is not shipped as part of EF or as part of the .NET Framework.
When Visual Studio is installed it will often also install a version of SQL Server, and this will include installation of the Microsoft.SqlServer.Types.dll
.
If SQL Server is not installed on the machine where you want to use spatial types, or if spatial types were excluded from the SQL Server installation, then you will need to install them manually. The types are included in the SQL Server Feature Packs, and different assemblies exist for SQL Server 2008 and SQL Server 2012.