我想在SQL Server 2016中使用SqlGeography的好处,并且在使用servicestack 4.5.14和ormlite的同时拥有Visual Studio 2017。
首先,我想将SqlGeography作为我所在位置的数据类型,但它会生成许多异常图片。
如果我使用DbGeography,则在按如下方式使用servicestack和ormlite时:
Db.Insert(location);
它是一个例外:
System.Data.SqlClient.SqlException: 'A .NET Framework error occurred
during execution of user-defined routine or aggregate "geography":
System.FormatException: 24114: The label {Geography:{Coordina in the
input well-known text (WKT) is not valid. Valid labels are POINT,
LINESTRING, POLYGON, MULTIPOINT, MULTILINESTRING, MULTIPOLYGON,
GEOMETRYCOLLECTION, CIRCULARSTRING, COMPOUNDCURVE, CURVEPOLYGON and
FULLGLOBE (geography Data Type only).
System.FormatException:
at Microsoft.SqlServer.Types.OpenGisTypes.ParseLabel(String input)
at
Microsoft.SqlServer.Types.WellKnownTextReader.ParseTaggedText
(OpenGisType type)
at Microsoft.SqlServer.Types.WellKnownTextReader.Read(OpenGisType
type, Int32 srid)
at Microsoft.SqlServer.Types.SqlGeography.ParseText(OpenGisType type,
SqlChars taggedText, Int32 srid)
at
Microsoft.SqlServer.Types.SqlGeography.GeographyFromText(OpenGisType
type, SqlChars taggedText, Int32 srid)
at Microsoft.SqlServer.Types.SqlGeography.Parse(SqlString s)
.
The statement has been terminated.'