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": {
|
"ConnectionStrings": {
|
||||||
"DefaultConnection": "DataSource=app.db"
|
"DefaultConnection": "DataSource=app.db;Cache=Shared"
|
||||||
},
|
},
|
||||||
"IdentityServer": {
|
"IdentityServer": {
|
||||||
"Clients": {
|
"Clients": {
|
||||||
|
|
|
||||||
|
|
@ -46,7 +46,7 @@ namespace MusicStore
|
||||||
// Add EF services to the services container
|
// Add EF services to the services container
|
||||||
// Add EF services to the services container
|
// Add EF services to the services container
|
||||||
services.AddDbContext<MusicStoreContext>(options =>
|
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
|
// Add Identity services to the services container
|
||||||
services.AddIdentity<ApplicationUser, IdentityRole>()
|
services.AddIdentity<ApplicationUser, IdentityRole>()
|
||||||
|
|
|
||||||
|
|
@ -46,7 +46,7 @@ namespace MusicStore
|
||||||
|
|
||||||
// Add EF services to the services container
|
// Add EF services to the services container
|
||||||
services.AddDbContext<MusicStoreContext>(options =>
|
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
|
// Add Identity services to the services container
|
||||||
services.AddIdentity<ApplicationUser, IdentityRole>()
|
services.AddIdentity<ApplicationUser, IdentityRole>()
|
||||||
|
|
|
||||||
|
|
@ -39,7 +39,7 @@ namespace MusicStore
|
||||||
|
|
||||||
// Add EF services to the services container
|
// Add EF services to the services container
|
||||||
services.AddDbContext<MusicStoreContext>(options =>
|
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
|
// Add Identity services to the services container
|
||||||
services.AddIdentity<ApplicationUser, IdentityRole>()
|
services.AddIdentity<ApplicationUser, IdentityRole>()
|
||||||
|
|
|
||||||
|
|
@ -57,7 +57,7 @@ namespace MusicStore
|
||||||
|
|
||||||
// Add EF services to the services container
|
// Add EF services to the services container
|
||||||
services.AddDbContext<MusicStoreContext>(options =>
|
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
|
// Add Identity services to the services container
|
||||||
services.AddIdentity<ApplicationUser, IdentityRole>()
|
services.AddIdentity<ApplicationUser, IdentityRole>()
|
||||||
|
|
|
||||||
|
|
@ -56,7 +56,7 @@ namespace MusicStore
|
||||||
|
|
||||||
// Add EF services to the services container
|
// Add EF services to the services container
|
||||||
services.AddDbContext<MusicStoreContext>(options =>
|
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
|
// Add Identity services to the services container
|
||||||
services.AddIdentity<ApplicationUser, IdentityRole>()
|
services.AddIdentity<ApplicationUser, IdentityRole>()
|
||||||
|
|
|
||||||
|
|
@ -92,7 +92,7 @@ namespace BasicApi
|
||||||
_isSQLite = true;
|
_isSQLite = true;
|
||||||
services
|
services
|
||||||
.AddEntityFrameworkSqlite()
|
.AddEntityFrameworkSqlite()
|
||||||
.AddDbContextPool<BasicApiContext>(options => options.UseSqlite("Data Source=BasicApi.db"));
|
.AddDbContextPool<BasicApiContext>(options => options.UseSqlite("Data Source=BasicApi.db;Cache=Shared"));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "SQLSERVER":
|
case "SQLSERVER":
|
||||||
|
|
|
||||||
|
|
@ -73,7 +73,7 @@ namespace BasicViews
|
||||||
_isSQLite = true;
|
_isSQLite = true;
|
||||||
services
|
services
|
||||||
.AddEntityFrameworkSqlite()
|
.AddEntityFrameworkSqlite()
|
||||||
.AddDbContextPool<BasicViewsContext>(options => options.UseSqlite("Data Source=BasicViews.db"));
|
.AddDbContextPool<BasicViewsContext>(options => options.UseSqlite("Data Source=BasicViews.db;Cache=Shared"));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "SQLSERVER":
|
case "SQLSERVER":
|
||||||
|
|
|
||||||
Binary file not shown.
|
|
@ -27,7 +27,7 @@
|
||||||
////#if (UseLocalDB)
|
////#if (UseLocalDB)
|
||||||
// "DefaultConnection": "Server=(localdb)\\mssqllocaldb;Database=aspnet-BlazorServerWeb-CSharp-53bc9b9d-9d6a-45d4-8429-2a2761773502;Trusted_Connection=True;MultipleActiveResultSets=true"
|
// "DefaultConnection": "Server=(localdb)\\mssqllocaldb;Database=aspnet-BlazorServerWeb-CSharp-53bc9b9d-9d6a-45d4-8429-2a2761773502;Trusted_Connection=True;MultipleActiveResultSets=true"
|
||||||
////#else
|
////#else
|
||||||
// "DefaultConnection": "DataSource=app.db"
|
// "DefaultConnection": "DataSource=app.db;Cache=Shared"
|
||||||
//#endif
|
//#endif
|
||||||
// },
|
// },
|
||||||
//#endif
|
//#endif
|
||||||
|
|
|
||||||
Binary file not shown.
|
|
@ -27,7 +27,7 @@
|
||||||
////#if (UseLocalDB)
|
////#if (UseLocalDB)
|
||||||
// "DefaultConnection": "Server=(localdb)\\mssqllocaldb;Database=aspnet-Company.WebApplication1-53bc9b9d-9d6a-45d4-8429-2a2761773502;Trusted_Connection=True;MultipleActiveResultSets=true"
|
// "DefaultConnection": "Server=(localdb)\\mssqllocaldb;Database=aspnet-Company.WebApplication1-53bc9b9d-9d6a-45d4-8429-2a2761773502;Trusted_Connection=True;MultipleActiveResultSets=true"
|
||||||
////#else
|
////#else
|
||||||
// "DefaultConnection": "DataSource=app.db"
|
// "DefaultConnection": "DataSource=app.db;Cache=Shared"
|
||||||
//#endif
|
//#endif
|
||||||
// },
|
// },
|
||||||
//#endif
|
//#endif
|
||||||
|
|
|
||||||
Binary file not shown.
|
|
@ -27,7 +27,7 @@
|
||||||
////#if (UseLocalDB)
|
////#if (UseLocalDB)
|
||||||
// "DefaultConnection": "Server=(localdb)\\mssqllocaldb;Database=aspnet-Company.WebApplication1-53bc9b9d-9d6a-45d4-8429-2a2761773502;Trusted_Connection=True;MultipleActiveResultSets=true"
|
// "DefaultConnection": "Server=(localdb)\\mssqllocaldb;Database=aspnet-Company.WebApplication1-53bc9b9d-9d6a-45d4-8429-2a2761773502;Trusted_Connection=True;MultipleActiveResultSets=true"
|
||||||
////#else
|
////#else
|
||||||
// "DefaultConnection": "DataSource=app.db"
|
// "DefaultConnection": "DataSource=app.db;Cache=Shared"
|
||||||
//#endif
|
//#endif
|
||||||
// },
|
// },
|
||||||
//#endif
|
//#endif
|
||||||
|
|
|
||||||
|
|
@ -4,15 +4,15 @@
|
||||||
////#if (UseLocalDB)
|
////#if (UseLocalDB)
|
||||||
// "DefaultConnection": "Server=(localdb)\\mssqllocaldb;Database=aspnet-Company.WebApplication1-53bc9b9d-9d6a-45d4-8429-2a2761773502;Trusted_Connection=True;MultipleActiveResultSets=true"
|
// "DefaultConnection": "Server=(localdb)\\mssqllocaldb;Database=aspnet-Company.WebApplication1-53bc9b9d-9d6a-45d4-8429-2a2761773502;Trusted_Connection=True;MultipleActiveResultSets=true"
|
||||||
////#else
|
////#else
|
||||||
// "DefaultConnection": "DataSource=app.db"
|
// "DefaultConnection": "DataSource=app.db;Cache=Shared"
|
||||||
////#endif
|
////#endif
|
||||||
// },
|
// },
|
||||||
////#endif
|
////#endif
|
||||||
"Logging": {
|
"Logging": {
|
||||||
"LogLevel": {
|
"LogLevel": {
|
||||||
"Default": "Information",
|
"Default": "Information",
|
||||||
"Microsoft": "Warning",
|
"Microsoft": "Warning",
|
||||||
"Microsoft.Hosting.Lifetime": "Information"
|
"Microsoft.Hosting.Lifetime": "Information"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
////#if (IndividualLocalAuth)
|
////#if (IndividualLocalAuth)
|
||||||
|
|
|
||||||
|
|
@ -4,15 +4,15 @@
|
||||||
////#if (UseLocalDB)
|
////#if (UseLocalDB)
|
||||||
// "DefaultConnection": "Server=(localdb)\\mssqllocaldb;Database=aspnet-Company.WebApplication1-53bc9b9d-9d6a-45d4-8429-2a2761773502;Trusted_Connection=True;MultipleActiveResultSets=true"
|
// "DefaultConnection": "Server=(localdb)\\mssqllocaldb;Database=aspnet-Company.WebApplication1-53bc9b9d-9d6a-45d4-8429-2a2761773502;Trusted_Connection=True;MultipleActiveResultSets=true"
|
||||||
////#else
|
////#else
|
||||||
// "DefaultConnection": "DataSource=app.db"
|
// "DefaultConnection": "DataSource=app.db;Cache=Shared"
|
||||||
////#endif
|
////#endif
|
||||||
// },
|
// },
|
||||||
////#endif
|
////#endif
|
||||||
"Logging": {
|
"Logging": {
|
||||||
"LogLevel": {
|
"LogLevel": {
|
||||||
"Default": "Information",
|
"Default": "Information",
|
||||||
"Microsoft": "Warning",
|
"Microsoft": "Warning",
|
||||||
"Microsoft.Hosting.Lifetime": "Information"
|
"Microsoft.Hosting.Lifetime": "Information"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
////#if (IndividualLocalAuth)
|
////#if (IndividualLocalAuth)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue