예제 #1
0
 public virtual void EnableTransparentPersistenceSupportFor(IInternalObjectContainer
                                                            container, IRollbackStrategy rollbackStrategy)
 {
     FlushOnQueryStarted(container);
     _rollbackStrategy = rollbackStrategy;
     _transparentPersistenceIsEnabled = true;
 }
		public virtual void EnableTransparentPersistenceSupportFor(IInternalObjectContainer
			 container, IRollbackStrategy rollbackStrategy)
		{
			FlushOnQueryStarted(container);
			_rollbackStrategy = rollbackStrategy;
			_transparentPersistenceIsEnabled = true;
		}
예제 #3
0
 private void ApplyRollbackStrategy(IRollbackStrategy rollbackStrategy)
 {
     if (null == rollbackStrategy)
     {
         return;
     }
     ApplyRollbackStrategy(rollbackStrategy, _modified.ValuesIterator());
     ApplyRollbackStrategy(rollbackStrategy, _removedAfterModified.ValuesIterator());
 }
예제 #4
0
            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;
 }
			private void ApplyRollbackStrategy(IRollbackStrategy rollbackStrategy, IEnumerator
				 values)
			{
				IObjectContainer objectContainer = _transaction.ObjectContainer();
				while (values.MoveNext())
				{
					rollbackStrategy.Rollback(objectContainer, values.Current);
				}
			}
			private void ApplyRollbackStrategy(IRollbackStrategy rollbackStrategy)
			{
				if (null == rollbackStrategy)
				{
					return;
				}
				ApplyRollbackStrategy(rollbackStrategy, _modified.ValuesIterator());
				ApplyRollbackStrategy(rollbackStrategy, _removedAfterModified.ValuesIterator());
			}
			public void Rollback(IRollbackStrategy rollbackStrategy)
			{
				ApplyRollbackStrategy(rollbackStrategy);
				_modified.Clear();
			}
예제 #12
0
 /// <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;
 }
예제 #13
0
 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;
 }