Allow "refreshing" instances via DatabaseBackedStore

This commit is contained in:
Dean Herbert
2017-10-25 18:28:28 +09:00
parent 5cd04392b4
commit 8452e315f4
3 changed files with 16 additions and 0 deletions

View File

@ -18,6 +18,11 @@ namespace osu.Game.Database
private readonly ThreadLocal<OsuDbContext> queryContext;
/// <summary>
/// Refresh an instance potentially from a diffrent thread with a local context-tracked instance.
/// </summary>
protected void Refresh<T>(ref T obj) where T : class, IHasPrimaryKey => obj = GetContext().Find<T>(obj.ID);
/// <summary>
/// Retrieve a shared context for performing lookups (or write operations on the update thread, for now).
/// </summary>