配置文件设置appsettings.json
{
"Logging": {
"LogLevel": {
"Default": "Warning"
}
},
"AllowedHosts": "*",
"ConnectionStrings": {
"SQLiteConnection": "Filename=./sqlite.db3"
}
}
Startup启动器中的配置服务中添加sqlite数据库上下文服务
services.AddDbContext<AppDbContext>(options => options.UseSqlite(Configuration.GetConnectionString("SQLiteConnection")));