Use SQLite write-ahead logging and shared caches
This will result in less locking and, thus, greater throughput.
This commit is contained in:
parent
9825c18323
commit
929f68bd87
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"ConnectionStrings": {
|
||||
"DefaultConnection": "DataSource=app.db"
|
||||
"DefaultConnection": "DataSource=app.db;Cache=Shared"
|
||||
},
|
||||
"IdentityServer": {
|
||||
"Clients": {
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ namespace MusicStore
|
|||
// Add EF services to the services container
|
||||
// Add EF services to the services container
|
||||
services.AddDbContext<MusicStoreContext>(options =>
|
||||
options.UseSqlite("Data Source=MusicStore.db"));
|
||||
options.UseSqlite("Data Source=MusicStore.db;Cache=Shared"));
|
||||
|
||||
// Add Identity services to the services container
|
||||
services.AddIdentity<ApplicationUser, IdentityRole>()
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ namespace MusicStore
|
|||
|
||||
// Add EF services to the services container
|
||||
services.AddDbContext<MusicStoreContext>(options =>
|
||||
options.UseSqlite("Data Source=MusicStore.db"));
|
||||
options.UseSqlite("Data Source=MusicStore.db;Cache=Shared"));
|
||||
|
||||
// Add Identity services to the services container
|
||||
services.AddIdentity<ApplicationUser, IdentityRole>()
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ namespace MusicStore
|
|||
|
||||
// Add EF services to the services container
|
||||
services.AddDbContext<MusicStoreContext>(options =>
|
||||
options.UseSqlite("Data Source=MusicStore.db"));
|
||||
options.UseSqlite("Data Source=MusicStore.db;Cache=Shared"));
|
||||
|
||||
// Add Identity services to the services container
|
||||
services.AddIdentity<ApplicationUser, IdentityRole>()
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ namespace MusicStore
|
|||
|
||||
// Add EF services to the services container
|
||||
services.AddDbContext<MusicStoreContext>(options =>
|
||||
options.UseSqlite("Data Source=MusicStore.db"));
|
||||
options.UseSqlite("Data Source=MusicStore.db;Cache=Shared"));
|
||||
|
||||
// Add Identity services to the services container
|
||||
services.AddIdentity<ApplicationUser, IdentityRole>()
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ namespace MusicStore
|
|||
|
||||
// Add EF services to the services container
|
||||
services.AddDbContext<MusicStoreContext>(options =>
|
||||
options.UseSqlite("Data Source=MusicStore.db"));
|
||||
options.UseSqlite("Data Source=MusicStore.db;Cache=Shared"));
|
||||
|
||||
// Add Identity services to the services container
|
||||
services.AddIdentity<ApplicationUser, IdentityRole>()
|
||||
|
|
|
|||
|
|
@ -92,7 +92,7 @@ namespace BasicApi
|
|||
_isSQLite = true;
|
||||
services
|
||||
.AddEntityFrameworkSqlite()
|
||||
.AddDbContextPool<BasicApiContext>(options => options.UseSqlite("Data Source=BasicApi.db"));
|
||||
.AddDbContextPool<BasicApiContext>(options => options.UseSqlite("Data Source=BasicApi.db;Cache=Shared"));
|
||||
break;
|
||||
|
||||
case "SQLSERVER":
|
||||
|
|
|
|||
|
|
@ -73,7 +73,7 @@ namespace BasicViews
|
|||
_isSQLite = true;
|
||||
services
|
||||
.AddEntityFrameworkSqlite()
|
||||
.AddDbContextPool<BasicViewsContext>(options => options.UseSqlite("Data Source=BasicViews.db"));
|
||||
.AddDbContextPool<BasicViewsContext>(options => options.UseSqlite("Data Source=BasicViews.db;Cache=Shared"));
|
||||
break;
|
||||
|
||||
case "SQLSERVER":
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -27,7 +27,7 @@
|
|||
////#if (UseLocalDB)
|
||||
// "DefaultConnection": "Server=(localdb)\\mssqllocaldb;Database=aspnet-BlazorServerWeb-CSharp-53bc9b9d-9d6a-45d4-8429-2a2761773502;Trusted_Connection=True;MultipleActiveResultSets=true"
|
||||
////#else
|
||||
// "DefaultConnection": "DataSource=app.db"
|
||||
// "DefaultConnection": "DataSource=app.db;Cache=Shared"
|
||||
//#endif
|
||||
// },
|
||||
//#endif
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -27,7 +27,7 @@
|
|||
////#if (UseLocalDB)
|
||||
// "DefaultConnection": "Server=(localdb)\\mssqllocaldb;Database=aspnet-Company.WebApplication1-53bc9b9d-9d6a-45d4-8429-2a2761773502;Trusted_Connection=True;MultipleActiveResultSets=true"
|
||||
////#else
|
||||
// "DefaultConnection": "DataSource=app.db"
|
||||
// "DefaultConnection": "DataSource=app.db;Cache=Shared"
|
||||
//#endif
|
||||
// },
|
||||
//#endif
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -27,7 +27,7 @@
|
|||
////#if (UseLocalDB)
|
||||
// "DefaultConnection": "Server=(localdb)\\mssqllocaldb;Database=aspnet-Company.WebApplication1-53bc9b9d-9d6a-45d4-8429-2a2761773502;Trusted_Connection=True;MultipleActiveResultSets=true"
|
||||
////#else
|
||||
// "DefaultConnection": "DataSource=app.db"
|
||||
// "DefaultConnection": "DataSource=app.db;Cache=Shared"
|
||||
//#endif
|
||||
// },
|
||||
//#endif
|
||||
|
|
|
|||
|
|
@ -4,15 +4,15 @@
|
|||
////#if (UseLocalDB)
|
||||
// "DefaultConnection": "Server=(localdb)\\mssqllocaldb;Database=aspnet-Company.WebApplication1-53bc9b9d-9d6a-45d4-8429-2a2761773502;Trusted_Connection=True;MultipleActiveResultSets=true"
|
||||
////#else
|
||||
// "DefaultConnection": "DataSource=app.db"
|
||||
// "DefaultConnection": "DataSource=app.db;Cache=Shared"
|
||||
////#endif
|
||||
// },
|
||||
////#endif
|
||||
"Logging": {
|
||||
"LogLevel": {
|
||||
"Default": "Information",
|
||||
"Microsoft": "Warning",
|
||||
"Microsoft.Hosting.Lifetime": "Information"
|
||||
"Default": "Information",
|
||||
"Microsoft": "Warning",
|
||||
"Microsoft.Hosting.Lifetime": "Information"
|
||||
}
|
||||
},
|
||||
////#if (IndividualLocalAuth)
|
||||
|
|
|
|||
|
|
@ -4,15 +4,15 @@
|
|||
////#if (UseLocalDB)
|
||||
// "DefaultConnection": "Server=(localdb)\\mssqllocaldb;Database=aspnet-Company.WebApplication1-53bc9b9d-9d6a-45d4-8429-2a2761773502;Trusted_Connection=True;MultipleActiveResultSets=true"
|
||||
////#else
|
||||
// "DefaultConnection": "DataSource=app.db"
|
||||
// "DefaultConnection": "DataSource=app.db;Cache=Shared"
|
||||
////#endif
|
||||
// },
|
||||
////#endif
|
||||
"Logging": {
|
||||
"LogLevel": {
|
||||
"Default": "Information",
|
||||
"Microsoft": "Warning",
|
||||
"Microsoft.Hosting.Lifetime": "Information"
|
||||
"Default": "Information",
|
||||
"Microsoft": "Warning",
|
||||
"Microsoft.Hosting.Lifetime": "Information"
|
||||
}
|
||||
},
|
||||
////#if (IndividualLocalAuth)
|
||||
|
|
|
|||
Loading…
Reference in New Issue