Where is the Sqlite database saved for asp.net core MVC 2.2?

asp.net-core asp.net-core-2.2 entity-framework-core

Popular Answer

Control where it is kept simply.

var connString = Configuration.GetConnectionString("MyDB").Replace("~", _env.ContentRootPath);
services.AddDbContext<RemoteHealingTechContext>(options => options.UseSqlite(connString));

taking use of _env in the constructor

public Startup(IConfiguration configuration, IHostingEnvironment env)
{
    Configuration = configuration;
    _env = env;
}

Afterward, you may use a connection string similar to this.

"DataSource=~\\App_Data\\MyDB.db"
0
3/26/2019 3:03:30 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