Changed database at the DI system to be transient

This commit is contained in:
Thorsten Sommer 2022-07-09 15:04:21 +02:00
parent fb0bb2b178
commit 9015e08518
Signed by: tsommer
GPG Key ID: 371BBA77A02C0108

View File

@ -30,7 +30,7 @@ public static class Setup
/// </summary>
public static void AddDatabase(this IServiceCollection serviceCollection, string path2DataFile, bool createWhenNecessary = true)
{
serviceCollection.AddDbContext<DataContext>(options => options.UseSqlite($"Filename={path2DataFile};Mode={(createWhenNecessary ? DB_READ_WRITE_CREATE_MODE : DB_READ_WRITE_MODE)}"));
serviceCollection.AddDbContext<DataContext>(options => options.UseSqlite($"Filename={path2DataFile};Mode={(createWhenNecessary ? DB_READ_WRITE_CREATE_MODE : DB_READ_WRITE_MODE)}"), ServiceLifetime.Transient);
}
/// <summary>