积极答复者
请教使用EntityFrameworkCore关联hierarchyId类型列异常的问题

问题
-
最近尝试研究使用了EntityFrameworkCore,试着把原来使用ADO.NET写的小项目重构一下,因为原来使用的就是SQLServer(测试的数据库版本是2008R2和2012),所以起始工作都很顺利,但今天遇到了一个问题,当系统只要调用到包含hierarchyid类型字段的数据表时,就会抛出“无法加载Microsoft.SqlServer.Types,找不到文件”的异常,最开始我觉得是我数据库安装的有问题,后来发现在别的服务器上运行也一样,网上说的Types的NuGet包我也安装了(这个好像没有Core版本的),依然没效果,所以想请教一下,如何解决这个问题,还是说目前框架就是还不支持hierarchyid这样的类型映射?
- 已编辑 ZQing 2018年7月25日 13:02
答案
-
你好,
目前的版本是不支持,你可以关注后续更新的版本看是否支持。
Best regards,
Zhanglong
MSDN Community Support
Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.- 已标记为答案 ZQing 2018年8月21日 8:33
全部回复
-
Microsoft.SqlServer.Types是SQL的SMO一部分,您可以在以下位置找到
C:\Program Files (x86)\Microsoft SQL Server\100\SDK\Assemblies\Microsoft.SqlServer.Types.dll
C:\Program Files (x86)\Microsoft SQL Server\110\SDK\Assemblies\Microsoft.SqlServer.Types.dll
C:\Program Files (x86)\Microsoft SQL Server\120\SDK\Assemblies\Microsoft.SqlServer.Types.dll
C:\Program Files (x86)\Microsoft SQL Server\130\SDK\Assemblies\Microsoft.SqlServer.Types.dll
C:\Program Files (x86)\Microsoft SQL Server\140\SDK\Assemblies\Microsoft.SqlServer.Types.dll
版本不同,程序集的位置不同。您看下异常的inner exception是无法载入哪个版本的Microsoft.SqlServer.Types
专注于.NET ERP/CRM开发框架,C/S架构,SQL Server + ORM(LLBL Gen Pro) + Infragistics WinForms
-
你好,
根据下午链接,现在EF Core 还不支持Microsoft.SqlServer.Types 里面所定义的类型, 比如HierarchyId。
https://github.com/aspnet/EntityFrameworkCore/issues/7239
Best regards,
Zhanglong
MSDN Community Support
Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com. -
你好,
目前的版本是不支持,你可以关注后续更新的版本看是否支持。
Best regards,
Zhanglong
MSDN Community Support
Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.- 已标记为答案 ZQing 2018年8月21日 8:33