Spatial Data Introduced to Entity Framework
One of the new additions in the Entity Framework June CTP is official support for Spatial data types. There have been workarounds for using these data types for some time, since SQL Server 2008 and onward have included Spatial, but this is the first primitive support in the Entity Data Model (EDM).
The Spatial data type allows developers to represent data that uses a system of coordinates, such as shapes, lines, or points on a map. There are two different types of spatial data that can be used: Geometry and Geography. Geometry describes locations on a flat (i.e. Euclidean) plane, and can be used to determine information such as the shape and area of a polygon. Geography is used for ellipsoidal data (to account for the shape of the Earth), and can refer to items like GPS coordinates. Both Geometry and Geography conform to the Open Geospatial Consortium (OGC) specifications.
Previously, Spatial data would be represented on the client side using the SqlGeography and SqlGeometry types. In Entity Framework the types are DbGeography and DbGeometry, with the eventual goal of supporting other data providers beyond SQL Server. (Currently, non-SQL Server-based uses of Spatial data are limited to basic services such as serialization and deserialization.)
Microsoft’s other goals for Spatial in Entity Framework are:
- first-class support for the Spatial data type in the Entity Designer
- a rich programming experience using Entity SQL and LINQ
- support for Code-first, Database-first, and Model-first approaches
York Xyander, Bodo Junglas Jul 31, 2015