public int Insert(TEntity entity) { lock (OBJLOCK) { VerifyExtension.Verity(entity); RemoveHoldingEntityInContext(entity); dbcontext.Entry <TEntity>(entity).State = EntityState.Added; return(dbcontext.SaveChanges()); } }
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(); } }