mirror of
https://github.com/ppy/osu.git
synced 2024-12-15 07:32:55 +08:00
Remove EF helper methods
This commit is contained in:
parent
bb5b9458e8
commit
6ddd2d59d3
@ -1,41 +0,0 @@
|
|||||||
// 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;
|
|
||||||
|
|
||||||
#nullable enable
|
|
||||||
|
|
||||||
namespace osu.Game.Database
|
|
||||||
{
|
|
||||||
public class EntityFrameworkLive<T> : ILive<T> where T : class
|
|
||||||
{
|
|
||||||
public EntityFrameworkLive(T item)
|
|
||||||
{
|
|
||||||
IsManaged = true; // no way to really know.
|
|
||||||
Value = item;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Guid ID => throw new InvalidOperationException();
|
|
||||||
|
|
||||||
public void PerformRead(Action<T> perform)
|
|
||||||
{
|
|
||||||
perform(Value);
|
|
||||||
}
|
|
||||||
|
|
||||||
public TReturn PerformRead<TReturn>(Func<T, TReturn> perform)
|
|
||||||
{
|
|
||||||
return perform(Value);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void PerformWrite(Action<T> perform)
|
|
||||||
{
|
|
||||||
perform(Value);
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool IsManaged { get; }
|
|
||||||
|
|
||||||
public T Value { get; }
|
|
||||||
|
|
||||||
public bool Equals(ILive<T>? other) => ID == other?.ID;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,14 +0,0 @@
|
|||||||
// 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.
|
|
||||||
|
|
||||||
namespace osu.Game.Database
|
|
||||||
{
|
|
||||||
public static class EntityFrameworkLiveExtensions
|
|
||||||
{
|
|
||||||
public static ILive<T> ToEntityFrameworkLive<T>(this T item)
|
|
||||||
where T : class
|
|
||||||
{
|
|
||||||
return new EntityFrameworkLive<T>(item);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user