Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 561
TRAL Avatar asked Jan 28 '26 15:01

TRAL


1 Answers

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

like image 97
Jay Zuo Avatar answered Jan 31 '26 06:01

Jay Zuo



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!