public LockTransactionContractBundle(IContractBundle contractBundle, LockOrder lockOrder = LockOrder.Unknown, ILockTransactionMember[] transactionMembers = null) : this(contractBundle.Preconditions, contractBundle.PostconditionsOnReturn, contractBundle.PostconditionsOnThrow, contractBundle.InstanceValidations, contractBundle.ThreadCountRestriction, contractBundle.ThreadCountRestrictionTimeout, contractBundle.ThreadWaitHandleSignalRestriction, contractBundle.ThreadWaitHandleSignalRestrictionTimeout, transactionMembers, lockOrder) { }
public LockTransactionContractBundle(IContractBundle contractBundle, LockOrder lockOrder = LockOrder.Unknown, ILockTransactionMember[] transactionMembers = null) :this(contractBundle.Preconditions, contractBundle.PostconditionsOnReturn, contractBundle.PostconditionsOnThrow, contractBundle.InstanceValidations, contractBundle.ThreadCountRestriction, contractBundle.ThreadCountRestrictionTimeout, contractBundle.ThreadWaitHandleSignalRestriction, contractBundle.ThreadWaitHandleSignalRestrictionTimeout, transactionMembers, lockOrder) { }
public LockTransactionContext(IContractBundle contractBundle, IContextBundle contextBundle):base(contextBundle) { this.contractBundle = contractBundle ?? new ContractBundle(); var transactionContractBundle = this.contractBundle as LockTransactionContractBundle; this.isValidTransaction = transactionContractBundle != null; this.transactionMembers = this.isValidTransaction ? transactionContractBundle.TransactionMembers : new ILockTransactionMember[0]; this.lockOrder = this.isValidTransaction ? transactionContractBundle.LockOrder : LockOrder.Unknown; if (this.isValidTransaction) { Info("Atomic transaction operation is in effect with {0} atomic members".WithValues(this.transactionMembers.Length)); this.transactionMembers = OrderLocksBy(this.transactionMembers, this.lockOrder).ToArray(); } }
public LockTransactionContext(IContractBundle contractBundle, IContextBundle contextBundle) : base(contextBundle) { this.contractBundle = contractBundle ?? new ContractBundle(); var transactionContractBundle = this.contractBundle as LockTransactionContractBundle; this.isValidTransaction = transactionContractBundle != null; this.transactionMembers = this.isValidTransaction ? transactionContractBundle.TransactionMembers : new ILockTransactionMember[0]; this.lockOrder = this.isValidTransaction ? transactionContractBundle.LockOrder : LockOrder.Unknown; if (this.isValidTransaction) { Info("Atomic transaction operation is in effect with {0} atomic members".WithValues(this.transactionMembers.Length)); this.transactionMembers = OrderLocksBy(this.transactionMembers, this.lockOrder).ToArray(); } }
public LockTransactionContractBundle(IImmutableQueue <IContractCondition> preconditions = null, IImmutableQueue <IContractCondition> postconditionsOnReturn = null, IImmutableQueue <IContractCondition> postconditionsOnThrow = null, IImmutableQueue <Action> instanceValidations = null, int threadCountRestriction = 0, WaitTimeout?threadCountRestrictionTimeout = null, WaitHandle threadWaitHandleSignalRestriction = null, WaitTimeout?threadWaitHandleSignalRestrictionTimeout = null, ILockTransactionMember[] transactionMembers = null, LockOrder lockOrder = Runtime.LockOrder.Unknown) : base(preconditions, postconditionsOnReturn, postconditionsOnThrow, instanceValidations, threadCountRestriction, threadCountRestrictionTimeout, threadWaitHandleSignalRestriction, threadWaitHandleSignalRestrictionTimeout) { this.transactionMembers = transactionMembers.DefaultIfNull(); this.lockOrder = lockOrder; }
public LockTransactionContractBundle(IImmutableQueue<IContractCondition> preconditions = null, IImmutableQueue<IContractCondition> postconditionsOnReturn = null, IImmutableQueue<IContractCondition> postconditionsOnThrow = null, IImmutableQueue<Action> instanceValidations = null, int threadCountRestriction = 0, WaitTimeout? threadCountRestrictionTimeout = null, WaitHandle threadWaitHandleSignalRestriction = null, WaitTimeout? threadWaitHandleSignalRestrictionTimeout = null, ILockTransactionMember[] transactionMembers = null, LockOrder lockOrder = Runtime.LockOrder.Unknown) :base(preconditions, postconditionsOnReturn, postconditionsOnThrow, instanceValidations, threadCountRestriction, threadCountRestrictionTimeout, threadWaitHandleSignalRestriction, threadWaitHandleSignalRestrictionTimeout) { this.transactionMembers = transactionMembers.DefaultIfNull(); this.lockOrder = lockOrder; }
private static IEnumerable <ILockTransactionMember> OrderLocksBy(ILockTransactionMember[] members, LockOrder order) { switch (order) { case LockOrder.Default: return(members.OrderBy(x => x.Id)); case LockOrder.ParameterOrder: return(members); default: throw new ArgumentOutOfRangeException("order", order, "Lock order for transaction is unknown or invalid"); } }
private static IEnumerable<ILockTransactionMember> OrderLocksBy(ILockTransactionMember[] members, LockOrder order) { switch(order) { case LockOrder.Default: return members.OrderBy(x => x.Id); case LockOrder.ParameterOrder: return members; default: throw new ArgumentOutOfRangeException("order", order, "Lock order for transaction is unknown or invalid"); } }