add missing find method
This commit is contained in:
@@ -97,14 +97,25 @@ public abstract class DataManager : IDataManager
|
|||||||
|
|
||||||
public virtual bool Find<T>(int id, [NotNullWhen(true)] out T? obj) where T : class, IDataObject
|
public virtual bool Find<T>(int id, [NotNullWhen(true)] out T? obj) where T : class, IDataObject
|
||||||
{
|
{
|
||||||
if (FindEntity<T>(id) is not T t)
|
if (Find<T>(id) is T t)
|
||||||
{
|
{
|
||||||
|
obj = t;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
obj = default;
|
obj = default;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public virtual bool Find<T>(int? id, [NotNullWhen(true)] out T? obj) where T : class, IDataObject
|
||||||
|
{
|
||||||
|
if (Find<T>(id) is T t)
|
||||||
|
{
|
||||||
obj = t;
|
obj = t;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
obj = default;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
public virtual void Delete<T>(int id) where T : class, IDataObject
|
public virtual void Delete<T>(int id) where T : class, IDataObject
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ public interface IDataManager
|
|||||||
T? Find<T>(int id) where T : class, IDataObject;
|
T? Find<T>(int id) where T : class, IDataObject;
|
||||||
bool Find<T>(int id, [NotNullWhen(true)] out T? obj) where T : class, IDataObject;
|
bool Find<T>(int id, [NotNullWhen(true)] out T? obj) where T : class, IDataObject;
|
||||||
T? Find<T>(int? id) where T : class, IDataObject;
|
T? Find<T>(int? id) where T : class, IDataObject;
|
||||||
|
bool Find<T>(int? id, [NotNullWhen(true)] out T? obj) where T : class, IDataObject;
|
||||||
T FindOrNew<T>(int id) where T : class, IDataObject;
|
T FindOrNew<T>(int id) where T : class, IDataObject;
|
||||||
bool FindOrNew<T>(int id, [NotNullWhen(true)] out T? obj) where T : class, IDataObject;
|
bool FindOrNew<T>(int id, [NotNullWhen(true)] out T? obj) where T : class, IDataObject;
|
||||||
T FindOrNew<T>(int? id) where T : class, IDataObject;
|
T FindOrNew<T>(int? id) where T : class, IDataObject;
|
||||||
|
|||||||
Reference in New Issue
Block a user