I'm testing EFCore 2.0.3 in a UWP project using System.Data.SqlClient
.
If I connect to a SQL Server instance, it works OK, but when changing to LocalDB, I get an error:
LocalDB is not supported on this platform
My connection string is this:
Data Source=(LocalDB)\MSSQLLocalDB;AttachDbFileName=\Statistics.mdf;Initial Catalog=Statistics;Integrated Security=True;Connect Timeout=30
My LocalDB version is (using SQL Server 2016): v13.1.4001.0
EFCore 2.0.3 does not support LocalDB, or am I missing something?
From .Net standard 2.0, we can use the SQL Server database in a UWP app, but your UWP app must configure target version and min version 16299 or more higher version. You can change them by right click your project => Properties => Application tab.
You can see the document Use a SQL Server database in a UWP app and the sample: https://github.com/StefanWickDev/IgniteDemos/tree/master/NorthwindDemo
Besides, here is also a similar thread you can have a reference:
How to connect to SQL server database from a Windows 10 UWP app
---Update---
Currently, UWP app doesn't support the LocalDB on 16299 and 17134. But in my test, LocalDB can work well in WPF app and Console app, this is my connect string:
public string LocalDBConnectionString = @"Data Source=(localdb)\MSSQLLocalDB;
Initial Catalog=master;Integrated Security=True;
Connect Timeout=30;Encrypt=False;
TrustServerCertificate=True;
ApplicationIntent=ReadWrite;MultiSubnetFailover=False";