public void Commit() { lock (StmModified.commitLock) { Lock(inTxDict.Keys.ToArray()); try { bool isValid = CheckIsValid(); if (isValid) { if (parentTransaction == null) { foreach (StmRef <T> stmRef in toUpdate) { stmRef.content = RefTuple <T, long> .Get((T)inTxDict[stmRef], stmRef.Version, this.Revision); } } else { foreach (StmRef <T> stmRef in toUpdate) { stmRef.content = RefTuple <T, long> .Get((T)inTxDict[stmRef], this.Revision, stmRef.ParentVersion); } } } IsCommited = (isValid || IsParentConflict); } finally { UnLock(inTxDict.Keys.ToArray()); } } }
public void Commit() { Lock(inTxDict.Keys.ToArray()); try { bool isValid = true; foreach (StmRef <T> stmRef in inTxDict.Keys) { if (stmRef.Version != version[stmRef]) { isValid = false; break; } } if (isValid) { foreach (StmRef <T> stmRef in toUpdate) { stmRef.content = RefTuple <T, long> .Get((T)inTxDict[stmRef], this.Revision, 0); } } IsCommited = isValid; } finally { UnLock(inTxDict.Keys.ToArray()); } }