using System; using Luticate2.Utils.Dbo; using Microsoft.EntityFrameworkCore; namespace Luticate2.Utils.DataAccess { public abstract class LuEfDataAccess : LuDataAccess where TModel : class where TDbContext : DbContext { protected readonly TDbContext Db; protected readonly DbSet Table; protected LuEfDataAccess(TDbContext db, DbSet table) { Db = db; Table = table; } public LuResult Execute(Func> func) { try { return func(); } catch (Exception e) { return LuResult.Error(LuStatus.DbError, e); } } } }