获得一个 Azure 函数,该函数应该调用上下文来更新 DbGeography 的值。我不断收到此异常:
Spatial types and functions are not available for this provider because the assembly 'Microsoft.SqlServer.Types' version 10 or higher could not be found.
我在 Azure Function 项目中安装了 NuGet 包。目前,Azure Function 尚未发布,我在本地运行它。即使部署了该功能,解决这些问题也是很好的。
最佳答案
根据您的错误消息,我认为您的问题与您尝试部署到未安装 SQL Server 的 CLR 类型的计算机有关。
您说您已经安装了 Nuget 包,因此我建议您还可以检查 native SqlServerSpatial110.dll 程序集的适当版本是否已复制到输出目录并与您的应用程序一起部署。有关此问题的更多详细信息,您可以引用此article .
您还可以检查是否安装了 Microsoft System CLR Types。欲了解更多详情,您可以阅读此SO thread .
After a lot of research I just installed "Microsoft System CLR Types for SQL Server 2012" from:
X86 - http://go.microsoft.com/fwlink/?LinkID=239643&clcid=0x409
X64 - http://go.microsoft.com/fwlink/?LinkID=239644&clcid=0x409
Worked like a charm!
此外,如果我在 Microsoft.SqlServer.Types 包中使用 SqlGeography,它在我这边工作得很好:
Azure函数中的代码:
Azure 门户中的结果:
关于entity-framework - Azure 函数和空间类型以及程序集 'Microsoft.SqlServer.Types',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49798239/