UWP/EF核心SqlServer-线程依赖关系



我正在尝试使用Microsoft.EntityFrameworkCore.SQL Server,但我似乎没有适当的线程依赖项。当使用NuGet尝试安装EF Core SS时,我收到了以下几条消息:

Restoring packages for c:visual studio 2015ProjectsAxiomAxiomproject.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数据库。参考实体框架7与SQLite的C#应用程序:

目前EF只支持UWP上的SQLite。有关安装Entity Framework 7和创建模型的详细演练,请参见"通用Windows平台入门"页面。

实体框架7现在通俗地说是实体框架核心1.0或EF核心1.0。

在EF Core的文档中,我们还可以发现

Microsoft SQL Server支持的平台

  • 完整.NET(4.5.1以后版本(
  • .NET核心
  • 单声道(4.2.0以后(

SQLite支持的平台

  • 完整.NET(4.5.1以后版本(
  • .NET核心
  • 单声道(4.2.0以后(
  • 通用Windows平台

因此Microsoft.EntityFrameworkCore.SqlServer目前还不能与UWP兼容。从UWP应用程序访问SQL Server数据库的常见方式是托管数据服务,应用程序通过REST API或使用WCF服务查询数据。有关更多信息,您可以查看此问题的答案:如何从Windows 10 UWP应用程序连接到SQL server数据库

最新更新