Esempio n. 1
0
 public int Insert(TEntity entity)
 {
     lock (OBJLOCK)
     {
         VerifyExtension.Verity(entity);
         RemoveHoldingEntityInContext(entity);
         dbcontext.Entry <TEntity>(entity).State = EntityState.Added;
         return(dbcontext.SaveChanges());
     }
 }
Esempio n. 2
0
 public int Commit()
 {
     try
     {
         var returnValue = dbcontext.SaveChanges();
         if (dbTransaction != null)
         {
             dbTransaction.Commit();
         }
         return(returnValue);
     }
     catch (Exception)
     {
         if (dbTransaction != null)
         {
             this.dbTransaction.Rollback();
         }
         throw;
     }
     finally
     {
         this.Dispose();
     }
 }