COA.EnterpriseServices/COA.EnterpriseServices.DataAccess/Helpers/BaseHelper.cs

14 lines
476 B
C#

using System.Linq;
namespace COA.EnterpriseServices.DataAccess.Helpers
{
public class BaseHelper<T> where T : class, IRecord
{
protected DataAccessManager<T> DataAccessManager { get; } = Dependencies.Container.GetInstance<DataAccessManager<T>>();
public virtual T Get(int id) => DataAccessManager.Invoke(d => d.Get(i => i.Id == id).FirstOrDefault());
public virtual bool Add(T item) => DataAccessManager.Invoke(d => d.Add(item));
}
}