Use SQLite write-ahead logging and shared caches

This will result in less locking and, thus, greater throughput.
This commit is contained in:
Brice Lambson 2020-04-08 13:51:12 -07:00
parent 9825c18323
commit 929f68bd87
16 changed files with 19 additions and 19 deletions

View File

@ -1,6 +1,6 @@
{ {
"ConnectionStrings": { "ConnectionStrings": {
"DefaultConnection": "DataSource=app.db" "DefaultConnection": "DataSource=app.db;Cache=Shared"
}, },
"IdentityServer": { "IdentityServer": {
"Clients": { "Clients": {

View File

@ -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>()

View File

@ -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>()

View File

@ -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>()

View File

@ -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>()

View File

@ -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>()

View File

@ -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":

View File

@ -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":

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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)

View File

@ -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)