This topic is applicable to Entity Framework v5 and v6. For Entity Framework Core, see Spatial Data Support for EF Core.
In Oracle, the MDSYS.SDO_GEOMETRY object type is used to represent spatials. Entity Framework 5 uses DbGeometry and DbGeography types from the System.Data.Entity.dll assembly for this purpose (.NET Framework 4.5). Entity Framework 6 uses DbGeometry and DbGeography types from the EntityFramework.dll (.NET Framework 4.0 and .NET Framework 4.5).
When using XML mapping spatial types are mapped in the following way in edmx/edml files:
Oracle data types | SSDL | CSDL | .NET |
---|---|---|---|
MDSYS.SDO_GEOMETRY | sdo_geometry | Geometry, GeometryCollection, GeometryLineString, GeometryMultiLineString, GeometryMultiPoint, GeometryMultiPolygon, GeometryPoint, GeometryPolygon | DbGeometry |
MDSYS.SDO_GEOMETRY | sdo_geography | Geography, GeographyCollection, GeographyLineString, GeographyMultiLineString, GeographyMultiPoint, GeographyMultiPolygon, GeographyPoint, GeographyPolygon | DbGeography |
When creating Entity Framework model in Entity Data Model Wizard or LightSwitch Attach Data Source Wizard using Database First approach, all spatial columns are mapped to DbGeometry, and it is impossible to change this behaviour currently. If you need to map properties to DbGeography, open the Entity Framework model with XML editor and replace data type for the required columns: "sdo_geometry" with "sdo_geography" in SSDL and "Geometry" with "Geography" in CSDL. When creating an Entity Framework model in Devart Entity Developer using Database First approach, you can define corresponding data type mapping rules.