UWP / EF Core SqlServer - 线程依赖

时间:2016-08-07 19:08:48

标签: c# sql-server entity-framework uwp entity-framework-core

我尝试使用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一起使用。

有人可以帮助我摆脱依赖地狱吗?

1 个答案:

答案 0 :(得分:2)

我们无法在UWP应用中直接访问SQL Server数据库。参考。 Entity framework 7 with SQLite for C# apps

  

目前EF仅支持UWP上的SQLite。有关安装Entity Framework 7和创建模型的详细演练,请访问Getting Started on Universal Windows Platform page

实体框架7现在通常是Entity Framework Core 1.0或EF Core 1.0。

在EF Core的文档中,我们也可以找到

  

Microsoft SQL Server Supported Platforms

     
      
  • 完整的.NET(4.5.1以后)
  •   
  • .NET Core
  •   
  • 单声道(4.2.0起)
  •   
     

SQLite Supported Platforms

     
      
  • 完整的.NET(4.5.1以后)
  •   
  • .NET Core
  •   
  • 单声道(4.2.0起)
  •   
  • 通用Windows平台
  •   

所以Microsoft.EntityFrameworkCore.SqlServer目前与UWP并不兼容。从UWP应用程序访问SQL Server数据库的常用方法是托管数据服务,应用程序通过REST API查询数据或使用WCF服务。有关详情,请查看此问题的答案:How to connect to SQL server database from a Windows 10 UWP app

相关问题