Skip to content

a .NET Standard implementation of the spatial types in `Microsoft.SqlServer.Types`

License

Notifications You must be signed in to change notification settings

KarloX2/Microsoft.SqlServer.Types

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Microsoft.SqlServer.Types

a .NET Standard implementation of the spatial types in Microsoft.SqlServer.Types

Usage

Input parameter

Assigning SqlGeometry or SqlGeography to a command parameter:

   command.Parameters.AddWithValue("@GeographyColumn", mySqlGeography);
   command.Parameters["@GeometryColumn"].UdtTypeName = "Geography";

   command.Parameters.AddWithValue("@GeographyColumn", mySqlGeometry);
   command.Parameters["@GeometryColumn"].UdtTypeName = "Geometry" 

The geometry will automatically be correctly serialized.

Reading geometry and geography

Due to the "real" Microsoft.SqlServer.Types assembly isn't available, the types won't be deserialized automatically. Instead you'll need to use the Deserialize method:

   var binvalue = reader.GetSqlBytes(rowid);
   var geometry = SqlGeometry.Deserialize(binvalue);

About

a .NET Standard implementation of the spatial types in `Microsoft.SqlServer.Types`

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C# 100.0%