TRAL
TRAL

Reputation: 127

UWP / EF Core SqlServer - Threading Dependency

I'm attempting to use Microsoft.EntityFrameworkCore.SqlServer, but I appear to not have an appropriate Threading dependency. When using NuGet to attempt to install EF Core SS, I get several messages like the following:

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 ==========

I note that EFC.SqlServer has a reference to System.Threading.Thread in .NETStandard v1.3, but I have no idea how to acquire the dependency if it isn't already installed.

Or does this message simply mean that EFC.SqlServer isn't compatible with UAP due to the Threading requirement? The EFC website seems to indicate that you can use SqlServer with UWP.

Can someone help me out of dependency hell?

Upvotes: 3

Views: 1274

Answers (1)

Jay Zuo
Jay Zuo

Reputation: 15758

We can't direct access SQL Server database in UWP apps. Ref. Entity framework 7 with SQLite for C# apps:

Currently EF only supports SQLite on UWP. A detailed walkthrough on installing Entity Framework 7, and creating models is available at the Getting Started on Universal Windows Platform page.

Entity Framework 7 is now Entity Framework Core 1.0 or EF Core 1.0 colloquially.

And in documentation for EF Core, we can also find that

Microsoft SQL Server Supported Platforms

  • Full .NET (4.5.1 onwards)
  • .NET Core
  • Mono (4.2.0 onwards)

SQLite Supported Platforms

  • Full .NET (4.5.1 onwards)
  • .NET Core
  • Mono (4.2.0 onwards)
  • Universal Windows Platform

So Microsoft.EntityFrameworkCore.SqlServer isn't compatible with UWP by now. The common way to access SQL Server database form a UWP app is host a data service and the app query the data through the REST API or use WCF service. For more info, you can check the answer in this question: How to connect to SQL server database from a Windows 10 UWP app

Upvotes: 2

Related Questions