public void Commit() { DataContext.SaveChanges(); }
public bool Insert(T entity) { using (var tran = dataContext.Database.BeginTransaction()) { try { dbSet.Add(entity); var SuccessResult = dataContext.SaveChanges(); tran.Commit(); return(SuccessResult > 0); } catch (Exception e) { tran.Rollback(); throw e.InnerException ?? e; } } }