1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-14 08:43:01 +08:00

Fill out xmldoc and adjust inline commentary

This commit is contained in:
Bartłomiej Dach 2023-08-16 09:40:46 +02:00
parent 6e11162ab1
commit d70a9a5bc4
No known key found for this signature in database

View File

@ -13,10 +13,13 @@ namespace osu.Game.Database
/// If a match was not found, a <see cref="Realm.Refresh"/> is performed before trying a second time. /// If a match was not found, a <see cref="Realm.Refresh"/> is performed before trying a second time.
/// This ensures that an instance is found even if the realm requested against was not in a consistent state. /// This ensures that an instance is found even if the realm requested against was not in a consistent state.
/// </summary> /// </summary>
/// <param name="realm"></param> /// <param name="realm">The realm to operate on.</param>
/// <param name="id"></param> /// <param name="id">The ID of the entity to find in the realm.</param>
/// <typeparam name="T"></typeparam> /// <typeparam name="T">The type of the entity to find in the realm.</typeparam>
/// <returns></returns> /// <returns>
/// The retrieved entity of type <typeparamref name="T"/>.
/// Can be <see langword="null"/> if the entity is still not found by <paramref name="id"/> even after a refresh.
/// </returns>
public static T? FindWithRefresh<T>(this Realm realm, Guid id) where T : IRealmObject public static T? FindWithRefresh<T>(this Realm realm, Guid id) where T : IRealmObject
{ {
var found = realm.Find<T>(id); var found = realm.Find<T>(id);
@ -24,7 +27,7 @@ namespace osu.Game.Database
if (found == null) if (found == null)
{ {
// It may be that we access this from the update thread before a refresh has taken place. // It may be that we access this from the update thread before a refresh has taken place.
// To ensure that behaviour matches what we'd expect (the object *is* available), force // To ensure that behaviour matches what we'd expect (the object generally *should be* available), force
// a refresh to bring in any off-thread changes immediately. // a refresh to bring in any off-thread changes immediately.
realm.Refresh(); realm.Refresh();
found = realm.Find<T>(id); found = realm.Find<T>(id);