This topic is applicable to Entity Framework v5 and v6. For Entity Framework Core, see Spatial Data Support for EF Core.
A spatial service is used for reading spatial objects from the database, saving objects to database, working with static and instance methods and properties of the DbGeometry and DbGeography classes.
The NetTopologySuiteSpatialService class is used. It uses NetTopologySuite library.
Provider value is a NetTopologySuite object, which can be used with third-party libraries that support NetTopologySuite (like SharpMap v1 and higher).
This service requires NetTopologySuite.dll, GeoAPI.dll, and PowerCollections.dll assemblies from the NetTopologySuite project website.
MySqlWktSpatialService class is used. Provider value is a WKT representation (string), which can be used with third-party libraries that support WKT.
MySqlExtendedWktSpatialService class is used. Provider value is a EWKT (WKT with SRID specified) representation (string), which can be used with third-party libraries that support EWKT.
MySqlWkbSpatialService class is used. Provider value is a WKB representation (byte[]), which can be used with third-party libraries that support WKB.
WKB data is compact, so it generates less traffic than WKT or EWKT.
Spatial service | DbGeometry and DbGeography | SRID | WellKnownValue support1 | Stored procedures and functions | |
---|---|---|---|---|---|
In params and function return value | Out / InOut params | ||||
NetTopologySuite | 2 | ||||
Well-Known Text (WKT) | 3 | 4 | |||
Extended Well-Known Text (EWKT) | 3 | ||||
Well-Known Binary (WKB) | 3 | 4 |
1 DbGeometryWellKnownValue and DbGeographyWellKnownValue data types support (data contract serializable representation of a DbGeometry/DbGeography values).
2 Most features are supported, but not all of them.
3 Minimal feature set is supported. See details in the DbGeometry/DbGeography Support in Spatial Services topic.
4 When persisting data to the database, default SRID values from the GeometryDefaultSrid and GeographyDefaultSrid settings are used. When retrieving SDO_GEOMETRY data from the database, its WKT/WKB representation is retrieved, and SRID is ignored.
See the Spatial Service Type topic to get more information on specifying which spatial service to use.