2020-10-14 16:10:25 +00:00
|
|
|
|
using System.Linq;
|
|
|
|
|
|
|
|
|
|
namespace COA.EnterpriseServices.DataAccess.Helpers
|
2020-10-14 12:35:14 +00:00
|
|
|
|
{
|
|
|
|
|
public class BaseHelper<T> where T : class, IRecord
|
|
|
|
|
{
|
2020-10-14 21:57:39 +00:00
|
|
|
|
protected DataAccessManager<T> DataAccessManager { get; } = Dependencies.Container.GetInstance<DataAccessManager<T>>();
|
2020-10-14 15:03:25 +00:00
|
|
|
|
|
2020-10-14 16:10:25 +00:00
|
|
|
|
public virtual T Get(int id) => DataAccessManager.Invoke(d => d.Get(i => i.Id == id).FirstOrDefault());
|
2020-10-14 15:03:25 +00:00
|
|
|
|
|
2020-10-14 16:02:05 +00:00
|
|
|
|
public virtual bool Add(T item) => DataAccessManager.Invoke(d => d.Add(item));
|
2020-10-14 12:35:14 +00:00
|
|
|
|
}
|
|
|
|
|
}
|