How can I create a connection to my local database in a .NET Standard project? Because I want to use that in combination with an UWP application (no EF support).
Asked
Active
Viewed 1,795 times
0
-
https://learn.microsoft.com/en-us/ef/core/get-started/uwp/getting-started – Lee O. Sep 06 '18 at 19:12
-
@LeeO. That is for SQLITE – user7849697 Sep 06 '18 at 19:14
-
To use EF Core, install the package for the database provider(s) you want to target. This tutorial uses SQLite. For a list of available providers see Database Providers. – Lee O. Sep 06 '18 at 19:15
-
The tutorial is using SQLite but you can use full SqlServer. – Lee O. Sep 06 '18 at 19:16
-
https://learn.microsoft.com/en-us/windows/uwp/data-access/sql-server-databases – Lee O. Sep 06 '18 at 19:17
-
@LeeO. Yes I saw that, but I wanted to split the SQL stuff up into a .NET Standard project – user7849697 Sep 06 '18 at 19:47
-
https://garywoodfine.com/using-ef-core-in-a-separate-class-library-project/ – Lee O. Sep 06 '18 at 20:12
-
the tools is the tough part. Looks like you have to setup migrations in a project that targets a specific platform (core/framework/uwp/etc) but can do the rest in the .net standard project. – Lee O. Sep 06 '18 at 20:21
-
Hmm, I didn't read it fully, but it seems I don't have to set the connectionstring into the UWP project? – user7849697 Sep 07 '18 at 07:11
1 Answers
0
I didn't read it fully, but it seems I don't have to set the connectionstring into the UWP project?
You're right. You could set the connection string to initilize the SqlConnection
object and then connect to your local database.
You could check the Northwind Sample – UWP app connecting to SQL Server to learn how to do it.

Xie Steven
- 8,544
- 1
- 9
- 23