我正在嘗試使用Microsoft.EntityFrameworkCore.SqlServer,但我似乎沒有適當的Threading依賴項。當使用NuGet嘗試安裝EF Core SS時,我會收到以下幾條消息:
Restoring packages for c:\visual studio 2015\Projects\Axiom\Axiom\project.json...
System.Threading.Thread 4.0.0 provides a compile-time reference assembly for System.Threading.Thread on UAP,Version=v10.0, but there is no run-time assembly compatible with win10-arm.
Some packages are not compatible with UAP,Version=v10.0 (win10-arm).
System.Threading.Thread 4.0.0 provides a compile-time reference assembly for System.Threading.Thread on UAP,Version=v10.0, but there is no run-time assembly compatible with win10-arm-aot.
Some packages are not compatible with UAP,Version=v10.0 (win10-arm-aot).
System.Threading.Thread 4.0.0 provides a compile-time reference assembly for System.Threading.Thread on UAP,Version=v10.0, but there is no run-time assembly compatible with win10-x64.
Some packages are not compatible with UAP,Version=v10.0 (win10-x64).
...
Package restore failed for 'Axiom'.
Package restore failed. Rolling back package changes for 'Axiom'.
========== Finished ==========
我注意到EFC.SqlServer在.NETStandard v1.3中引用了System.Threading.Thread,但我不知道如果尚未安裝它,如何獲取依賴項。
或者此消息是否僅僅意味著由於線程要求,EFC.SqlServer與UAP不兼容? EFC網站似乎表明您可以將SqlServer與UWP一起使用。
有人可以幫助我擺脫依賴地獄嗎?
我們無法直接訪問UWP應用程序中的SQL Server數據庫。參考。 使用SQLite for C#apps的實體框架7 :
目前EF僅在UWP上支持SQLite。有關安裝Entity Framework 7和創建模型的詳細信息,請參閱“通用Windows平台入門”頁面 。
實體框架7現在通常是Entity Framework Core 1.0或EF Core 1.0。
在EF Core的文檔中,我們也可以找到它
- 完整的.NET(4.5.1以後)
- .NET核心
- 單聲道(4.2.0起)
- 完整的.NET(4.5.1以後)
- .NET核心
- 單聲道(4.2.0起)
- 通用Windows平台
所以Microsoft.EntityFrameworkCore.SqlServer
現在與UWP不兼容。從UWP應用程序訪問SQL Server數據庫的常用方法是託管數據服務,應用程序通過REST API查詢數據或使用WCF服務。有關詳細信息,您可以在以下問題中查看答案: 如何從Windows 10 UWP應用程序連接到SQL Server數據庫