Exemple #1
0
 public void Commit()
 {
     DataContext.SaveChanges();
 }
Exemple #2
0
 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;
         }
     }
 }