Rely on storage.DeleteDatabase for guaranteed database deletion

Relies on https://github.com/ppy/osu-framework/pull/1100 being merged for most effectiveness.
This commit is contained in:
Dean Herbert
2017-10-21 00:15:02 +09:00
parent b805174143
commit 47213d2498
2 changed files with 11 additions and 17 deletions

View File

@ -9,11 +9,19 @@ namespace osu.Game.Database
{
private readonly GameHost host;
private const string database_name = @"client";
public DatabaseContextFactory(GameHost host)
{
this.host = host;
}
public OsuDbContext GetContext() => new OsuDbContext(host.Storage.GetDatabaseConnectionString(@"client"));
public OsuDbContext GetContext() => new OsuDbContext(host.Storage.GetDatabaseConnectionString(database_name));
public void ResetDatabase()
{
// todo: we probably want to make sure there are no active contexts before performing this operation.
host.Storage.DeleteDatabase(database_name);
}
}
}