dotConnect for MySQL Documentation
In This Topic
    Default SRID
    In This Topic

    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.

    var config = MySqlEntityProviderConfig.Instance;
    config.SpatialOptions.GeometryDefaultSrid = 0; // this is the default value
    config.SpatialOptions.GeographyDefaultSrid = 4326; // this is the default value
    
    
    Dim config = MySqlEntityProviderConfig.Instance
    config.SpatialOptions.GeometryDefaultSrid = 0
    ' this is the default value
    config.SpatialOptions.GeographyDefaultSrid = 4326
    ' this is the default value
    
    

    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.MySql.Entity tag to the configuration tag:

     <Devart.Data.MySql.Entity xmlns="http://devart.com/schemas/Devart.Data.MySql.Entity/1.0">
      <SpatialOptions GeometryDefaultSrid="0" GeographyDefaultSrid="4326" />
     </Devart.Data.MySql.Entity>
    

    Note: If you need to set multiple Entity Framework provider options for dotConnect for MySQL, don't add multiple Devart.Data.MySql.Entity tags. Specify all settings in one Devart.Data.MySql.Entity tag.

    dotConnect for MySQL 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.

    See Also

    Choosing Spatial Service  | Area and Distance Units