This topic is applicable to Entity Framework v5 and v6. For Entity Framework Core, see Spatial Data Support for EF Core.
When creating DbGeometry / DbGeography using such static methods as FromText(String), FromBinary(Byte[]), FromGml(String), the default SRID values are used.
User can set these default values with the GeometryDefaultSrid and GeographyDefaultSrid settings.
Alternatively, you may specify the default SRID values in the project config file. For this, you need to update or add the configSections element like it is described in the Entity Framework Provider Configuration section and then add the following Devart.Data.PostgreSql.Entity tag to the configuration tag:
<Devart.Data.PostgreSql.Entity xmlns="http://devart.com/schemas/Devart.Data.PostgreSql.Entity/1.0"> <SpatialOptions GeometryDefaultSrid="0" GeographyDefaultSrid="4326" /> </Devart.Data.PostgreSql.Entity>
Note: If you need to set multiple Entity Framework provider options for dotConnect for PostgreSQL, don't add multiple Devart.Data.PostgreSql.Entity tags. Specify all settings in one Devart.Data.PostgreSql.Entity tag.
dotConnect for PostgreSQL also provides the following additional settings that control the use of default SRID values:
Enabling these options may be useful for EWKT and NetTopologySuite spatial services in case all the database objects have the same SRID value as it may increase performance of working with spatial data. It also reduces traffic a bit for all databases, which is useful when materializing a large number of spatial objects.