public virtual void EnableTransparentPersistenceSupportFor(IInternalObjectContainer container, IRollbackStrategy rollbackStrategy) { FlushOnQueryStarted(container); _rollbackStrategy = rollbackStrategy; _transparentPersistenceIsEnabled = true; }
private void ApplyRollbackStrategy(IRollbackStrategy rollbackStrategy) { if (null == rollbackStrategy) { return; } ApplyRollbackStrategy(rollbackStrategy, _modified.ValuesIterator()); ApplyRollbackStrategy(rollbackStrategy, _removedAfterModified.ValuesIterator()); }
private void ApplyRollbackStrategy(IRollbackStrategy rollbackStrategy, IEnumerator values) { IObjectContainer objectContainer = _transaction.ObjectContainer(); while (values.MoveNext()) { rollbackStrategy.Rollback(objectContainer, values.Current); } }
public bool Execute() { // we don't want to repeat executed actions... if (executed || ExecuteAction()) { executed = true; return(true); } if (rollbackStrategy == null) { // by default, we will rollback command itself rollbackStrategy = new RollbackOneStrategy(this); } rollbackStrategy.Rollback(); return(false); }
public void SetRollbackStrategy(IRollbackStrategy rollbackStrategy) { this.rollbackStrategy = rollbackStrategy; }
/// <summary> /// Constructor accepts rollbackStrategy to manage rollbacks. /// </summary> /// <param name="rollbackStrategy"></param> protected BaseCommand(IRollbackStrategy rollbackStrategy) { SetRollbackStrategy(rollbackStrategy); }
/// <summary>Creates a new instance of TransparentPersistenceSupport class</summary> /// <param name="rollbackStrategy"> /// RollbackStrategy interface implementation, which /// defines the actions to be taken on the object when the transaction is rolled back. /// </param> public TransparentPersistenceSupport(IRollbackStrategy rollbackStrategy) { _rollbackStrategy = rollbackStrategy; }
public void Rollback(IRollbackStrategy rollbackStrategy) { ApplyRollbackStrategy(rollbackStrategy); _modified.Clear(); }
public SimpleTestCommand(IRollbackStrategy rollbackStrategy = null, bool emulateFail = false) : base(rollbackStrategy) { SetEmulateFail(emulateFail); }
public void SetCommands(List <ICommand> commands, IRollbackStrategy rollbackStrategy) { this.rollbackStrategy = rollbackStrategy; this.commands = commands; }