How do I setup Entity Framework Core 2.1 with Sqlite? - Connecting Database to My Solution

c# cross-platform entity-framework-core sqlite xamarin.forms

Question

I am not an expert on this technology yet, so I guess for most this is a very basic question... But I don't really know how to use DBContext and how can I really connect my database, to the cross-platform solution file... and which nuget packages should I use?... where do I reference it?... what classes should I make and what codes do I put in it?... These questions, that I don't even know how to apply on my solution, I hope it doesn't bother you guys...

My goal is to make a datagrid using xaml grid, binded with sqlite database using entity framework core 2.1...

If you can answer my question in a step-by-step guide that would be really helpful for me...

*How can I setup the Entity Framework Core 2.1 using the database that I created from sqlite?

    * My Database Location & Name: C:\sqlite\demo.db
    * My Target Framework: .Net Standard 2.0
    * My Visual Studio Version: 15.7.2
    * For Android, IOS, & UWP
1
0
6/11/2018 5:18:07 PM

Popular Answer

You can use the dotnet command line tool:

dotnet ef dbcontext scaffold "Data Source=demo.db;" Microsoft.EntityFrameworkCore.Sqlite -OutputDir DataFolder -c "context name"

https://docs.microsoft.com/en-us/ef/core/get-started/aspnetcore/existing-db

1
8/11/2018 9:51:59 PM


Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow