Add xmldoc and verbatim string markers

This commit is contained in:
Dean Herbert
2021-11-23 17:47:43 +09:00
parent 505fede44d
commit b1b6723826

View File

@ -49,8 +49,8 @@ namespace osu.Game.Database
/// </summary> /// </summary>
private readonly SemaphoreSlim contextCreationLock = new SemaphoreSlim(1); private readonly SemaphoreSlim contextCreationLock = new SemaphoreSlim(1);
private static readonly GlobalStatistic<int> refreshes = GlobalStatistics.Get<int>("Realm", "Dirty Refreshes"); private static readonly GlobalStatistic<int> refreshes = GlobalStatistics.Get<int>(@"Realm", @"Dirty Refreshes");
private static readonly GlobalStatistic<int> contexts_created = GlobalStatistics.Get<int>("Realm", "Contexts (Created)"); private static readonly GlobalStatistic<int> contexts_created = GlobalStatistics.Get<int>(@"Realm", @"Contexts (Created)");
private readonly object contextLock = new object(); private readonly object contextLock = new object();
private Realm? context; private Realm? context;
@ -60,14 +60,14 @@ namespace osu.Game.Database
get get
{ {
if (!ThreadSafety.IsUpdateThread) if (!ThreadSafety.IsUpdateThread)
throw new InvalidOperationException($"Use {nameof(CreateContext)} when performing realm operations from a non-update thread"); throw new InvalidOperationException(@$"Use {nameof(CreateContext)} when performing realm operations from a non-update thread");
lock (contextLock) lock (contextLock)
{ {
if (context == null) if (context == null)
{ {
context = CreateContext(); context = CreateContext();
Logger.Log($"Opened realm \"{context.Config.DatabasePath}\" at version {context.Config.SchemaVersion}"); Logger.Log(@$"Opened realm ""{context.Config.DatabasePath}"" at version {context.Config.SchemaVersion}");
} }
// creating a context will ensure our schema is up-to-date and migrated. // creating a context will ensure our schema is up-to-date and migrated.
@ -76,6 +76,12 @@ namespace osu.Game.Database
} }
} }
/// <summary>
/// Construct a new instance of a realm context factory.
/// </summary>
/// <param name="storage">The game storage which will be used to create the realm backing file.</param>
/// <param name="filename">The filename to use for the realm backing file. A ".realm" extension will be added automatically if not specified.</param>
/// <param name="efContextFactory">An EF factory used only for migration purposes.</param>
public RealmContextFactory(Storage storage, string filename, IDatabaseContextFactory? efContextFactory = null) public RealmContextFactory(Storage storage, string filename, IDatabaseContextFactory? efContextFactory = null)
{ {
this.storage = storage; this.storage = storage;
@ -83,7 +89,7 @@ namespace osu.Game.Database
Filename = filename; Filename = filename;
const string realm_extension = ".realm"; const string realm_extension = @".realm";
if (!Filename.EndsWith(realm_extension, StringComparison.Ordinal)) if (!Filename.EndsWith(realm_extension, StringComparison.Ordinal))
Filename += realm_extension; Filename += realm_extension;
@ -286,7 +292,7 @@ namespace osu.Game.Database
throw new ObjectDisposedException(nameof(RealmContextFactory)); throw new ObjectDisposedException(nameof(RealmContextFactory));
if (!ThreadSafety.IsUpdateThread) if (!ThreadSafety.IsUpdateThread)
throw new InvalidOperationException($"{nameof(BlockAllOperations)} must be called from the update thread."); throw new InvalidOperationException(@$"{nameof(BlockAllOperations)} must be called from the update thread.");
Logger.Log(@"Blocking realm operations.", LoggingTarget.Database); Logger.Log(@"Blocking realm operations.", LoggingTarget.Database);
@ -310,7 +316,7 @@ namespace osu.Game.Database
timeout -= sleep_length; timeout -= sleep_length;
if (timeout < 0) if (timeout < 0)
throw new TimeoutException("Took too long to acquire lock"); throw new TimeoutException(@"Took too long to acquire lock");
} }
} }
catch catch