我安裝了Nuget Microsoft.SqlServer.Types
並且有DLL版本的問題。 我已閱讀自述與在Global.asax(網絡表單的Web應用程序)的添加行Microsoft.SqlServer.Types.SqlGeography DLL在GAC中
protected void Application_Start(object sender, EventArgs e)
{
SqlServerTypes.Utilities.LoadNativeAssemblies(Server.MapPath("~/bin"));
}
「」類型的異常出現在System.Data.DataSetExtensions.dll但沒有在用戶代碼中處理
附加信息:[A] Microsoft.SqlServer.Types.SqlGeography kan niet worden geconverteerd naar [B] Microsoft.SqlServer.Types.SqlGeography。類型A是上下文中的Microsoft.SqlServer.Types,版本= 10.0.0.0,Culture = neutral,PublicKeyToken = 89845dcd8080cc91默認操作位置C:\ WINDOWS \ assembly \ GAC_MSIL \ Microsoft.SqlServer.Types \ 10.0.0.0__89845dcd8080cc91 \ Microsoft.SqlServer.Types.dll。類型B是上下文中的Microsoft.SqlServer.Types,版本= 11.0.0.0,Culture = neutral,PublicKeyToken = 89845dcd8080cc91默認操作位置C:\ WINDOWS \ assembly \ GAC_MSIL \ Microsoft.SqlServer.Types \ 11.0.0.0__89845dcd8080cc91 \ Microsoft.SqlServer.Types.dll。
它沒有在這條線:
var bla = myDataTable.AsEnumerable().Select(x => new
{
Loc = x.Field<Microsoft.SqlServer.Types.SqlGeography>("theLocation") // breaks
}).ToList();
theLocation是地理數據類型在我的SQL Server 2008,所以對我來說沒有2016 FOR JSON PATH
選項不幸。
ps。一些背景信息:我安裝了nuget GeoJSON.Net和GeoJSON.Net.Contrib.MsSqlSpatial以將geography數據類型行作爲geojson。或者我應該在我的sql中添加.tostring並將其解析爲geojson點?