Remove Live<> wrapper until it is needed

This commit is contained in:
Dean Herbert
2021-01-13 18:36:05 +09:00
parent 8442b34e84
commit 9bf9a8c351
2 changed files with 0 additions and 131 deletions

View File

@ -1,7 +1,6 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System;
using System.Collections.Generic;
using AutoMapper;
using osu.Game.Beatmaps;
@ -69,31 +68,5 @@ namespace osu.Game.Database
return mapper.Map<T>(item);
}
/// <summary>
/// Wrap a managed instance of a realm object in a <see cref="Live{T}"/>.
/// </summary>
/// <param name="item">The item to wrap.</param>
/// <param name="contextFactory">A factory to retrieve realm contexts from.</param>
/// <typeparam name="T">The type of object.</typeparam>
/// <returns>A wrapped instance of the provided item.</returns>
public static Live<T> Wrap<T>(this T item, IRealmFactory contextFactory)
where T : RealmObject, IHasGuidPrimaryKey => new Live<T>(item, contextFactory);
/// <summary>
/// Wrap an unmanaged instance of a realm object in a <see cref="Live{T}"/>.
/// </summary>
/// <param name="item">The item to wrap.</param>
/// <typeparam name="T">The type of object.</typeparam>
/// <returns>A wrapped instance of the provided item.</returns>
/// <exception cref="ArgumentException">Throws if the provided item is managed.</exception>
public static Live<T> WrapAsUnmanaged<T>(this T item)
where T : RealmObject, IHasGuidPrimaryKey
{
if (item.IsManaged)
throw new ArgumentException("Provided item must not be managed", nameof(item));
return new Live<T>(item, null);
}
}
}