Jus*_*tin 9 c# sql-server sqlgeography sqlgeometry .net-standard
我正在尝试将我们所有的 C# 类库从 .NET Framework 转换为 .NET Standard 项目,因为我们开始利用 .NET Core,因此需要这些可以被 .NET Core 和 .NET Framework 应用程序使用(使用后者将在未来几个月内移植到 Core。)
我在转换数据访问层代码时遇到问题,因为我们广泛利用 Microsoft.SqlServer.Types,而官方 NuGet 包不支持 .NET Standard。我尝试了dotmorten的非官方 NuGet 包,但它缺少很多功能。下面是我们需要的所有缺失的列表(放在一起以获得代码构建......)
public static class SqlMockExtensions
{
public static SqlBytes STAsBinary(this SqlGeography geography) => throw new NotImplementedException();
public static SqlGeography MakeValid(this SqlGeography geography) => throw new NotImplementedException();
public static int STDimension(this SqlGeography geography) => throw new NotImplementedException();
public static bool STIsValid(this SqlGeography geography) => throw new NotImplementedException();
public static Nullable<double> EnvelopeAngle(this SqlGeography geography) => throw new NotImplementedException();
public static SqlGeography ReorientObject(this SqlGeography geography) => throw new NotImplementedException();
public static SqlGeography BufferWithTolerance(this SqlGeography geography, double arg1, int arg2, bool arg3) => throw new NotImplementedException();
public static SqlGeography Reduce(this SqlGeography geography, double tolerance) => throw new NotImplementedException();
public static SqlGeography EnvelopeCenter(this SqlGeography geography) => throw new NotImplementedException();
public static double STDistance(this SqlGeography geography, SqlGeography point2) => throw new NotImplementedException();
public static SqlBytes STAsBinary(this SqlGeometry geometry) => throw new NotImplementedException();
}
Run Code Online (Sandbox Code Playgroud)
当我搜索其他人试图将 Microsoft.SqlServer.Types 集成到他们的 .NET Core 和 Standard 项目时,我看到提到包含官方 NuGet 包,然后执行以下操作:
SqlServerTypes.Utilities.LoadNativeAssemblies(AppDomain.CurrentDomain.BaseDirectory);
Run Code Online (Sandbox Code Playgroud)
但是,当您尝试将不符合 .NET Standard 的 NuGet 包添加到 .NET Standard 项目时会出错,因此我不清楚这是如何解决的。
这似乎是一个非常普遍的问题,必须有很多开发人员利用 Microsoft.SqlServer.Types 进行 SqlGeography、SqlGeometry 等......并且正在移植到 .NET Standard。那么你们都是如何做到这一点的呢?
| 归档时间: |
|
| 查看次数: |
3333 次 |
| 最近记录: |