/// <summary> /// /// </summary> /// <param name="entities"></param> /// <returns></returns> public void VoidInsertListTimeControl(List <TModel> entities, DateTime requestTime) { using (var context = new DBContext.DBContext()) { using (DbContextTransaction transaction = context.Database.BeginTransaction()) { try { DALHelperMethods.HelperDALMethods.CheckRequestTimeOutDAL(requestTime); // dbSet.AddRange(entities); foreach (var entity in entities) { DALHelperMethods.HelperDALMethods.CheckRequestTimeOutDAL(requestTime); Customer newCustomer = new Customer(); foreach (PropertyInfo pi in entity.GetType().GetProperties()) { try { //get the value of property and try //to assign it to the property of T type object: newCustomer.GetType().GetProperty(pi.Name).SetValue(newCustomer, pi.GetValue(entity, null), null); } catch (Exception ex) { throw; } } DALHelperMethods.HelperDALMethods.CheckRequestTimeOutDAL(requestTime); context.Customers.Add(newCustomer); context.SaveChanges(); } DALHelperMethods.HelperDALMethods.CheckRequestTimeOutDAL(requestTime); transaction.Commit(); } catch (Exception e) { transaction.Rollback(); throw; } } } }
public RateRepository(DBContext.DBContext _context) : base(_context) { }
public RepositoryBase(DBContext.DBContext _context) { context = _context; }
public BankRepository(DBContext.DBContext _context) : base(_context) { }
public TalentRepository(DBContext.DBContext _context) : base(_context) { }