question

JuanDent-0991 avatar image
0 Votes"
JuanDent-0991 asked JuanDent-0991 answered

I want to connect from EntityFrameworkCore to sqlite3 database but don't know how to obtain connection string...

I have created a console project for C# and installed the following packages:

Microsoft.EntityFrameworkCore.Sqlite
Microsoft.EntityFrameworkCore
Microsoft.EntityFrameworkCore.Tools


I have a sqlite3 database at a path c:\Data\db.sqlite

How can I connect to this database (in particular what is the connection string?) and how can I reverse engineer the database into my C# project? (i.e. creation of DbContext and models)







dotnet-entity-frameworkdotnet-sqlite
· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

I tried this in Package Manager Console:



 scaffold-DbContext "Data Source=c:\Data\SeguroMedicoMFC.sqlite;"

and I got this question:

Supply values for the following parameters:

Provider:


I supplied this: Microsoft.EntityFrameworkCore.Sqlite and it worked: I got all the models and the dbcontext

But now I need the connection string, what is it??

0 Votes 0 ·

1 Answer

JuanDent-0991 avatar image
0 Votes"
JuanDent-0991 answered

the connection string is simply: "Data Source=c:\Data\SeguroMedicoMFC.sqlite;"

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.