Keep track of the data file's path
This commit is contained in:
parent
22778fbcf6
commit
3ef7bf1784
@ -11,6 +11,10 @@ public static class Setup
|
||||
private const string DB_READ_WRITE_MODE = "ReadWrite";
|
||||
private const string DB_READ_WRITE_CREATE_MODE = "ReadWriteCreate";
|
||||
|
||||
private static string usedDataFile = string.Empty;
|
||||
|
||||
public static string DataFile => Setup.usedDataFile;
|
||||
|
||||
/// <summary>
|
||||
/// Tries to migrate the data file.
|
||||
/// </summary>
|
||||
@ -30,7 +34,8 @@ 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)}"), ServiceLifetime.Transient);
|
||||
Setup.usedDataFile = path2DataFile;
|
||||
serviceCollection.AddDbContext<DataContext>(options => options.UseSqlite($"Filename={path2DataFile};Mode={(createWhenNecessary ? DB_READ_WRITE_CREATE_MODE : DB_READ_WRITE_MODE)};"), ServiceLifetime.Transient);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
Loading…
Reference in New Issue
Block a user