/// <summary>
        /// Creates a transaction Committer with the Business Object added.
        /// </summary>
        /// <returns>Returns the transaction object</returns>
        protected virtual ITransactionCommitter CreateSaveTransaction()
        {
            ITransactionCommitter committer = BORegistry.DataAccessor.CreateTransactionCommitter();

            committer.AddBusinessObject(_bo);
            return(committer);
        }
Exemple #2
0
 public TransactionCommitterTestGrain(
     [TransactionCommitter(TransactionTestConstants.RemoteCommitService, TransactionTestConstants.TransactionStore)] ITransactionCommitter <IRemoteCommitService> committer,
     ILoggerFactory loggerFactory)
 {
     this.committer     = committer;
     this.loggerFactory = loggerFactory;
 }
Exemple #3
0
        protected override void CleanAchskopieTables(ITransactionCommitter transactionComitter)
        {
            var kopieSektorTypeName                    = typeof(KopieSektor).Name;
            var kopieAchsensegmentTypeName             = typeof(KopieAchsenSegment).Name;
            var KopieAchseTypeName                     = typeof(KopieAchse).Name;
            var kopieAchseIdPropertyName               = ExpressionHelper.GetPropertyName <KopieAchse, Guid>(ka => ka.Id);
            var kopieAchsensegmentAchsenIdPropertyName = ExpressionHelper.GetPropertyName <KopieAchsenSegment, Guid>(kas => kas.AchsenId);
            var kopieAchsenOwnerPropertyName           = ExpressionHelper.GetPropertyName <KopieAchse, string>(ka => ka.Owner);
            var kopieSektorSegmentIdPropertyName       = ExpressionHelper.GetPropertyName <KopieSektor, Guid>(ks => ks.SegmentId);
            var kopieAchsensegmentIdPropertyName       = ExpressionHelper.GetPropertyName <KopieAchsenSegment, Guid>(kas => kas.Id);


            {
                IQuery qry = transactionComitter.Session.CreateQuery(string.Format("delete from {0} sektor where sektor.{1} in (select {2} from {3} segment where segment.{4} in (select {5} from {6} achse where achse.{7} = :owner))",
                                                                                   new string[] { kopieSektorTypeName, kopieSektorSegmentIdPropertyName, kopieAchsensegmentIdPropertyName, kopieAchsensegmentTypeName, kopieAchsensegmentAchsenIdPropertyName, kopieAchseIdPropertyName, KopieAchseTypeName, kopieAchsenOwnerPropertyName }));
                qry.SetString("owner", owner);
                qry.ExecuteUpdate();
            }
            {
                IQuery qry = transactionComitter.Session.CreateQuery(string.Format("delete from {0} segment where segment.{1} in (select {2} from {3} achse where achse.{4} = :owner)",
                                                                                   new string[] { kopieAchsensegmentTypeName, kopieAchsensegmentAchsenIdPropertyName, kopieAchseIdPropertyName, KopieAchseTypeName, kopieAchsenOwnerPropertyName }));
                qry.SetString("owner", owner);
                qry.ExecuteUpdate();
            }
            {
                IQuery qry = transactionComitter.Session.CreateQuery(string.Format("delete from {0} achse where achse.{1} = :owner",
                                                                                   new string[] { KopieAchseTypeName, kopieAchsenOwnerPropertyName }));
                qry.SetString("owner", owner);
                qry.ExecuteUpdate();
            }
            transactionComitter.ForceNext();
        }
Exemple #4
0
        /// <summary>
        /// Interface to add the number generator to a transaction via the transaction committer.
        /// </summary>
        /// <param name="transactionCommitter"></param>
        public void AddToTransaction(ITransactionCommitter transactionCommitter)
        {
            BusinessObject busObject = GetTransactionalBO();

            busObject.UpdateObjectBeforePersisting(transactionCommitter);
            transactionCommitter.AddBusinessObject(busObject);
        }
Exemple #5
0
        public void Test_SavingToMultipleSources()
        {
            //---------------Set up test pack-------------------
            DataStoreInMemory dataStore1 = new DataStoreInMemory();
            DataStoreInMemory dataStore2 = new DataStoreInMemory();

            DataAccessorInMemory dataAccessorInMemory1 = new DataAccessorInMemory(dataStore1);
            DataAccessorInMemory dataAccessorInMemory2 = new DataAccessorInMemory(dataStore2);

            DataAccessorMultiSource dataAccessor = new DataAccessorMultiSource(new DataAccessorInMemory());

            dataAccessor.AddDataAccessor(typeof(MyBO), dataAccessorInMemory1);
            dataAccessor.AddDataAccessor(typeof(MyRelatedBo), dataAccessorInMemory2);
            MyBO.LoadDefaultClassDef();
            MyRelatedBo.LoadClassDef();
            var bo1 = new MyBO();
            var bo2 = new MyRelatedBo();
            //---------------Execute Test ----------------------
            ITransactionCommitter committer1 = dataAccessor.CreateTransactionCommitter();

            committer1.AddBusinessObject(bo1);
            committer1.CommitTransaction();

            ITransactionCommitter committer2 = dataAccessor.CreateTransactionCommitter();

            committer2.AddBusinessObject(bo2);
            committer2.CommitTransaction();

            //---------------Test Result -----------------------
            Assert.IsNotNull(dataStore1.Find <MyBO>(bo1.ID));
            Assert.IsNotNull(dataStore2.Find <MyRelatedBo>(bo2.ID));
            //---------------Tear down -------------------------
        }
        ///<summary>
        /// Executes any custom code required by the business object before it is persisted to the database.
        /// This has the additionl capability of creating or updating other business objects and adding these
        /// to the transaction committer.
        /// <remarks> Recursive call to UpdateObjectBeforePersisting will not be done i.e. it is the bo developers responsibility to implement</remarks>
        ///</summary>
        ///<param name="transactionCommitter">the transaction committer that is executing the transaction</param>
        protected internal override void UpdateObjectBeforePersisting(ITransactionCommitter transactionCommitter)
        {
            base.UpdateObjectBeforePersisting(transactionCommitter);
            INumberGenerator numGen = new NumberGenerator("GeneratedNumber");

            this.GeneratedNumber = numGen.NextNumber().ToString();
            numGen.AddToTransaction(transactionCommitter);
        }
 public void AddTransaction(ITransactional transaction)
 {
     if (_myDataAccessor == null)
     {
         _myDataAccessor = _defaultDataAccessor;
         _transactionCommitter = _myDataAccessor.CreateTransactionCommitter();
     }
     _transactionCommitter.AddTransaction(transaction);
 }
 ///<summary>
 /// This method adds an <see cref="ITransactional"/> to the list of transactions.
 ///</summary>
 ///<param name="transaction">The transaction to add to the <see cref="ITransactionCommitter"/>.</param>
 public void AddTransaction(ITransactional transaction)
 {
     if (_myDataAccessor == null)
     {
         _myDataAccessor       = _defaultDataAccessor;
         _transactionCommitter = _myDataAccessor.CreateTransactionCommitter();
     }
     _transactionCommitter.AddTransaction(transaction);
 }
Exemple #9
0
        /// <summary>
        /// Commits to the database all the business objects that are either
        /// new or have been altered since the last committal
        /// </summary>
        public override void SaveAll()
        {
            ITransactionCommitter committer = BORegistry.DataAccessor.CreateTransactionCommitter();

            foreach (TBusinessObject bo in _removedBusinessObjects)
            {
                committer.AddBusinessObject(bo);
            }
            SaveAllInTransaction(committer);
            _removedBusinessObjects.Clear();
        }
        public AxisImportDataHandler(ITransactionCommitter transactionCommitter, IAxisImportMonitor axisImportMonitor, int impNr, AxisImportPass pass)
        {
            this.transactionCommitter = transactionCommitter;
            this.AxisImportMonitor    = axisImportMonitor;

            transactionCommitter.ForceNext();

            this.ImpNr = impNr;
            this.Pass  = pass;

            CheckCancelled();
        }
 ///<summary>
 /// Add an object of type business object to the transaction.
 /// The DBTransactionCommiter wraps this Business Object in the
 /// appropriate Transactional Business Object
 ///</summary>
 ///<param name="businessObject"></param>
 public void AddBusinessObject(IBusinessObject businessObject)
 {
     if (_myDataAccessor == null)
     {
         _myDataAccessor = GetDataAccessorForType(businessObject.GetType());
         _transactionCommitter = _myDataAccessor.CreateTransactionCommitter();
     } else
     {
         IDataAccessor dataAccessorToUseForType = GetDataAccessorForType(businessObject.GetType());
         if (dataAccessorToUseForType != _myDataAccessor)
         {
             throw new HabaneroDeveloperException("A problem occurred while trying to save, please see log for details", string.Format("A BusinessObject of type {0} was added to a TransactionCommitterMultiSource which has been set up with a different source to this type.", businessObject.GetType().FullName));
         }
     }
     _transactionCommitter.AddBusinessObject(businessObject);
 }
Exemple #12
0
        protected virtual void CleanAchskopieTables(ITransactionCommitter transactionComitter)
        {
            var kopieSektorTypeName = typeof(KopieSektor).Name;

            transactionComitter.Session.Delete(string.Format("from {0}", kopieSektorTypeName));
            transactionComitter.ForceNext();

            var kopieAchsenSegmentTypeName = typeof(KopieAchsenSegment).Name;

            transactionComitter.Session.Delete(string.Format("from {0}", kopieAchsenSegmentTypeName));
            transactionComitter.ForceNext();

            var kopieAchseTypeName = typeof(KopieAchse).Name;

            transactionComitter.Session.Delete(string.Format("from {0}", kopieAchseTypeName));
            transactionComitter.ForceNext();
        }
Exemple #13
0
        public void Test_DeleteBusinessObject_Success()
        {
            //---------------Set up test pack-------------------
            ITransactionCommitter transactionCommitter  = GetTransactionCommitter();
            IBusinessObject       boToDelete            = MockRepository.GenerateMock <IBusinessObject>();
            DefaultBODeletor      businessObjectDeletor = new DefaultBODeletor();

            //---------------Assert Precondition----------------
            Assert.IsNotNull(transactionCommitter);
            transactionCommitter.AssertWasNotCalled(committer => committer.CommitTransaction());
            //---------------Execute Test ----------------------
            businessObjectDeletor.DeleteBusinessObject(boToDelete);
            //---------------Test Result -----------------------
            boToDelete.AssertWasCalled(o => o.MarkForDelete());
            transactionCommitter.AssertWasCalled(committer => committer.CommitTransaction());
            boToDelete.AssertWasNotCalled(o => o.CancelEdits());
        }
 ///<summary>
 /// Add an object of type business object to the transaction.
 /// The DBTransactionCommiter wraps this Business Object in the
 /// appropriate Transactional Business Object
 ///</summary>
 ///<param name="businessObject"></param>
 public void AddBusinessObject(IBusinessObject businessObject)
 {
     if (_myDataAccessor == null)
     {
         _myDataAccessor       = GetDataAccessorForType(businessObject.GetType());
         _transactionCommitter = _myDataAccessor.CreateTransactionCommitter();
     }
     else
     {
         IDataAccessor dataAccessorToUseForType = GetDataAccessorForType(businessObject.GetType());
         if (dataAccessorToUseForType != _myDataAccessor)
         {
             throw new HabaneroDeveloperException("A problem occurred while trying to save, please see log for details", string.Format("A BusinessObject of type {0} was added to a TransactionCommitterMultiSource which has been set up with a different source to this type.", businessObject.GetType().FullName));
         }
     }
     _transactionCommitter.AddBusinessObject(businessObject);
 }
Exemple #15
0
        private void runImport(ITransactionCommitter transactionComitter, string filename, int impNr, importType type)
        {
            if (type == importType.Full)
            {
                CleanAchskopieTables(transactionComitter);
            }
            {
                AxisImportDataHandler dataHandler = getImportDataHandler(transactionComitter, axisImportMonitor,
                                                                         impNr, AxisImportPass.Achsen, type);
                AxisReader2 axisReader = new AxisReader2(filename, dataHandler);
                axisReader.Parse();

                Statistics += dataHandler.Statistics;
            }
            if (type == importType.Full)
            {
                transactionComitter.ForceNext();
            }
            {
                AxisImportDataHandler dataHandler = getImportDataHandler(transactionComitter, axisImportMonitor,
                                                                         impNr, AxisImportPass.Segmente, type);

                AxisReader2 axisReader = new AxisReader2(filename, dataHandler);
                axisReader.Parse();

                Statistics += dataHandler.Statistics;
            }
            if (type == importType.Full)
            {
                transactionComitter.ForceNext();
            }
            {
                AxisImportDataHandler dataHandler = getImportDataHandler(transactionComitter, axisImportMonitor,
                                                                         impNr, AxisImportPass.Sektoren, type);

                AxisReader2 axisReader = new AxisReader2(filename, dataHandler);
                axisReader.Parse();

                Statistics += dataHandler.Statistics;
            }
            if (type == importType.Full)
            {
                transactionComitter.ForceNext();
            }
        }
Exemple #16
0
        public void Test_UsingDefaultBusinessObjectLoader()
        {
            //---------------Set up test pack-------------------
            DataAccessorMultiSource dataAccessor = new DataAccessorMultiSource(new DataAccessorInMemory());
            ITransactionCommitter   committer    = dataAccessor.CreateTransactionCommitter();

            MyBO.LoadDefaultClassDef();
            var bo1 = new MyBO();

            committer.AddBusinessObject(bo1);
            committer.CommitTransaction();
            //---------------Execute Test ----------------------
            var loadedBo1 = dataAccessor.BusinessObjectLoader.GetBusinessObject <MyBO>(bo1.ID);

            //---------------Test Result -----------------------
            Assert.AreSame(loadedBo1, bo1);
            //---------------Tear down -------------------------
        }
        public void TestCompareThroughRelationship()
        {
            //---------------Set up test pack-------------------
            Car car1 = new Car();

            car1.CarRegNo = "5";
            Car car2 = new Car();

            car2.CarRegNo = "2";

            Engine engine1 = new Engine();

            engine1.CarID    = car1.CarID;
            engine1.EngineNo = "20";

            Engine engine2 = new Engine();

            engine2.CarID    = car2.CarID;
            engine2.EngineNo = "50";

            ITransactionCommitter committer = BORegistry.DataAccessor.CreateTransactionCommitter();

            committer.AddBusinessObject(car1);
            committer.AddBusinessObject(car2);
            committer.AddBusinessObject(engine1);
            committer.AddBusinessObject(engine2);
            committer.CommitTransaction();

            //---------------Assert PreConditions---------------
            //---------------Execute Test ----------------------
            PropertyComparer <Engine, string> comparer = new PropertyComparer <Engine, string>("CarRegNo");

            comparer.Source = new Source("Car");
            int comparisonResult = comparer.Compare(engine1, engine2);

            //---------------Test Result -----------------------
            Assert.Greater(comparisonResult, 0, "engine1 should be greater as its car's regno is greater");
            //---------------Tear Down -------------------------
        }
Exemple #18
0
        public void TestCompare_ThroughRelationship()
        {
            //---------------Set up test pack-------------------
            Car car1 = new Car();

            car1.CarRegNo = "2";
            Car car2 = new Car();

            car2.CarRegNo = "2";

            Engine engine1 = new Engine();

            engine1.CarID    = car1.CarID;
            engine1.EngineNo = "20";

            Engine engine2 = new Engine();

            engine2.CarID    = car2.CarID;
            engine2.EngineNo = "50";

            ITransactionCommitter committer = BORegistry.DataAccessor.CreateTransactionCommitter();

            committer.AddBusinessObject(car1);
            committer.AddBusinessObject(car2);
            committer.AddBusinessObject(engine1);
            committer.AddBusinessObject(engine2);
            committer.CommitTransaction();

            IOrderCriteria orderCriteria = QueryBuilder.CreateOrderCriteria(engine1.ClassDef, "Car.CarRegNo, EngineNo");

            //---------------Assert PreConditions---------------
            //---------------Execute Test ----------------------
            int comparisonResult = orderCriteria.Compare(engine1, engine2);

            //---------------Test Result -----------------------
            Assert.Less(comparisonResult, 0, "engine1 should be less as the car regnos are equal and its engine no is less");
            //---------------Tear Down -------------------------
        }
Exemple #19
0
        public void TestField_Compare_ThroughRelationship()
        {
            //---------------Set up test pack-------------------
            Car car1 = new Car();

            car1.CarRegNo = "5";
            Car car2 = new Car();

            car2.CarRegNo = "2";

            Engine engine1 = new Engine();

            engine1.CarID    = car1.CarID;
            engine1.EngineNo = "20";

            Engine engine2 = new Engine();

            engine2.CarID    = car2.CarID;
            engine2.EngineNo = "50";

            ITransactionCommitter committer = BORegistry.DataAccessor.CreateTransactionCommitter();

            committer.AddBusinessObject(car1);
            committer.AddBusinessObject(car2);
            committer.AddBusinessObject(engine1);
            committer.AddBusinessObject(engine2);
            committer.CommitTransaction();

            OrderCriteriaField orderCriteriaField = OrderCriteriaField.FromString("Engine.Car.CarRegNo");

            //---------------Assert PreConditions---------------
            //---------------Execute Test ----------------------
            int comparisonResult = orderCriteriaField.Compare(engine1, engine2);

            //---------------Test Result -----------------------
            Assert.Greater(comparisonResult, 0, "engine1 should be greater as its car's regno is greater");
            //---------------Tear Down -------------------------
        }
 /// <summary>
 /// A handler to respond when the "OK" button has been pressed.
 /// All changes are committed to the database and the dialog is closed.
 /// </summary>
 /// <param name="sender">The object that notified of the event</param>
 /// <param name="e">Attached arguments regarding the event</param>
 private void OKButtonHandler(object sender, EventArgs e)
 {
     try
     {
         _panelInfo.ApplyChangesToBusinessObject();
         ITransactionCommitter committer = CreateSaveTransaction();
         committer.CommitTransaction();
         DialogResult = DialogResult.OK;
         if (_postObjectEditAction != null)
         {
             _postObjectEditAction(this._bo, false);
         }
         _panelInfo.BusinessObject = null;
         SafeCloseForm();
     }
     catch (Exception ex)
     {
         log.Error(ExceptionUtilities.GetExceptionString(ex, 0, true));
         GlobalRegistry.UIExceptionNotifier.Notify(ex,
                                                   "There was a problem saving for the following reason(s):",
                                                   "Saving Problem");
     }
 }
Exemple #21
0
        AxisImportDataHandler getImportDataHandler(ITransactionCommitter transactionComitter,
                                                   IAxisImportMonitor axisImportMonitor, int impNr, AxisImportPass importPass, importType type)
        {
            AxisImportDataHandler dataHandler;

            switch (type)
            {
            case importType.Incremental:
                dataHandler = new AxisImportDataHandlerIncr(transactionComitter,
                                                            axisImportMonitor, impNr, importPass);
                break;

            case importType.Full:
                dataHandler = new AxisImportDataHandlerFull(transactionComitter,
                                                            axisImportMonitor, impNr, importPass);
                break;

            default:
                dataHandler = null;
                break;
            }
            return(dataHandler);
        }
Exemple #22
0
        public void Test_DeleteBusinessObject_Failure()
        {
            //---------------Set up test pack-------------------
            ITransactionCommitter transactionCommitter  = GetTransactionCommitter();
            DefaultBODeletor      businessObjectDeletor = new DefaultBODeletor();
            IBusinessObject       boToDelete            = new FakeAddress();
            Exception             expectedException     = new Exception();

            transactionCommitter.Stub(t => t.CommitTransaction()).Throw(expectedException);
            //---------------Assert Precondition----------------
            //---------------Execute Test ----------------------

            try
            {
                businessObjectDeletor.DeleteBusinessObject(boToDelete);
                Assert.Fail("Expected to throw an Exception");
            }
            //---------------Test Result -----------------------
            catch (Exception exception)
            {
                Assert.AreSame(expectedException, exception);
            }
        }
 public TransactionCommitterRemote(ITransactionCommitter remoteTransactionCommitter)
 {
     _remoteTransactionCommitter = remoteTransactionCommitter;
 }
Exemple #24
0
        //protected internal override void BeforeSave(ITransactionCommitter transactionCommiter)
        //{
        //    CombinedParts = FirstPart + SecondPart;
        //}

        ///<summary>
        /// Executes any custom code required by the business object before it is persisted to the database.
        /// This has the additionl capability of creating or updating other business objects and adding these
        /// to the transaction committer.
        /// <remarks> Recursive call to UpdateObjectBeforePersisting will not be done i.e. it is the bo developers responsibility to implement</remarks>
        ///</summary>
        ///<param name="transactionCommitter">the transaction committer that is executing the transaction</param>
        protected internal override void UpdateObjectBeforePersisting(ITransactionCommitter transactionCommitter)
        {
            CombinedParts = FirstPart + SecondPart;
        }
 /// <summary>
 /// Steps to carry out before the Save() command is run. You can add objects to the current
 /// transaction using this method, such as a database number generator.  No validity checks are 
 /// made to the BusinessObject after this step, so be careful not to invalidate the object.
 /// </summary>
 /// <param name="transactionCommitter">The current transaction committer - any objects added to this will
 /// be committed in the same transaction as this one.</param>
 protected internal override void UpdateObjectBeforePersisting(ITransactionCommitter transactionCommitter)
 {
     transactionCommitter.AddBusinessObject(new FakeBOWithUpdateBeforePersisting());
 }
 /// <summary>
 /// Steps to carry out before the Save() command is run. You can add objects to the current
 /// transaction using this method, such as a database number generator.  No validity checks are 
 /// made to the BusinessObject after this step, so be careful not to invalidate the object.
 /// </summary>
 /// <param name="transactionCommitter">The current transaction committer - any objects added to this will
 /// be committed in the same transaction as this one.</param>
 protected internal override void UpdateObjectBeforePersisting(ITransactionCommitter transactionCommitter)
 {
     transactionCommitter.AddTransaction(new StubSuccessfullTransaction());
 }
Exemple #27
0
 ///<summary>
 /// Executes any custom code required by the business object before it is persisted to the database.
 /// This has the additionl capability of creating or updating other business objects and adding these
 /// to the transaction committer.
 ///</summary>
 ///<param name="transactionCommitter">the transaction committer that is executing the transaction</param>
 protected internal virtual void UpdateObjectBeforePersisting(ITransactionCommitter transactionCommitter)
 {
     _businessObject.UpdateObjectBeforePersisting(transactionCommitter);
 }
		/// <summary>
		/// Adds the sequence number change to the persistence transaction
		/// </summary>
		/// <param name="transactionCommitter">The transaction committer suitable
		/// for the persistence environment</param>
		public void AddToTransaction(ITransactionCommitter transactionCommitter)
		{
			var busObject = this.GetBOSequenceNumberLocking();
			transactionCommitter.AddBusinessObject(busObject);
		}
Exemple #29
0
 public AxisImportDataHandlerIncr(ITransactionCommitter transactionComitter, IAxisImportMonitor axisImportMonitor, int impNr, AxisImportPass pass)
     : base(transactionComitter, axisImportMonitor, impNr, pass)
 {
 }
 /// <summary>
 /// Interface to add the number generator to a transaction via the transaction committer.
 /// </summary>
 /// <param name="transactionCommitter"></param>
 public void AddToTransaction(ITransactionCommitter transactionCommitter)
 {
     BusinessObject busObject = GetTransactionalBO();
     busObject.UpdateObjectBeforePersisting(transactionCommitter);
     transactionCommitter.AddBusinessObject(busObject);
 }
 protected override void UpdateObjectBeforePersisting(ITransactionCommitter transactionCommitter)
 {
     if (_updateObjectBeforePersistingDelegate != null)
     {
         _updateObjectBeforePersistingDelegate(transactionCommitter);
     }
     base.UpdateObjectBeforePersisting(transactionCommitter);
 }
 /// <summary>
 /// Steps to carry out before the Save() command is run. You can add objects to the current
 /// transaction using this method, such as a database number generator.  No validity checks are
 /// made to the BusinessObject after this step, so be careful not to invalidate the object.
 /// </summary>
 /// <param name="transactionCommitter">The current transaction committer - any objects added to this will
 /// be committed in the same transaction as this one.</param>
 protected internal override void UpdateObjectBeforePersisting(ITransactionCommitter transactionCommitter)
 {
     transactionCommitter.AddTransaction(new StubSuccessfullTransaction());
 }
Exemple #33
0
        /// <summary>
        /// Adds the sequence number change to the persistence transaction
        /// </summary>
        /// <param name="transactionCommitter">The transaction committer suitable
        /// for the persistence environment</param>
        public void AddToTransaction(ITransactionCommitter transactionCommitter)
        {
            var busObject = this.GetBOSequenceNumberLocking();

            transactionCommitter.AddBusinessObject(busObject);
        }
		///<summary>
		/// Executes any custom code required by the business object before it is persisted to the database.
		/// This has the additionl capability of creating or updating other business objects and adding these
		/// to the transaction committer.
		/// <remarks> Recursive call to UpdateObjectBeforePersisting will not be done i.e. it is the bo developers responsibility to implement</remarks>
		///</summary>
		///<param name="transactionCommitter">the transaction committer that is executing the transaction</param>
		protected internal override void UpdateObjectBeforePersisting(ITransactionCommitter transactionCommitter)
		{
			base.UpdateObjectBeforePersisting(transactionCommitter);
			INumberGenerator numGen = new NumberGenerator("GeneratedNumber");
			this.GeneratedNumber = numGen.NextNumber().ToString();
			numGen.AddToTransaction(transactionCommitter);
		}
Exemple #35
0
 private void RunInitialFullImport(ITransactionCommitter transactionComitter, string filename)
 {
     runImport(transactionComitter, filename, 1, importType.Full);
 }
Exemple #36
0
        //protected internal override void BeforeSave(ITransactionCommitter transactionCommiter)
        //{
        //    CombinedParts = FirstPart + SecondPart;
        //}

        ///<summary>
        /// Executes any custom code required by the business object before it is persisted to the database.
        /// This has the additionl capability of creating or updating other business objects and adding these
        /// to the transaction committer.
        /// <remarks> Recursive call to UpdateObjectBeforePersisting will not be done i.e. it is the bo developers responsibility to implement</remarks>
        ///</summary>
        ///<param name="transactionCommitter">the transaction committer that is executing the transaction</param>
        protected internal override void UpdateObjectBeforePersisting(ITransactionCommitter transactionCommitter)
        {
            CombinedParts = FirstPart + SecondPart;
        }
 ///<summary>
 /// Executes any custom code required by the business object before it is persisted to the database.
 /// This has the additionl capability of creating or updating other business objects and adding these
 /// to the transaction committer.
 /// <remarks> Recursive call to UpdateObjectBeforePersisting will not be done i.e. it is the bo developers responsibility to implement</remarks>
 ///</summary>
 ///<param name="transactionCommitter">the transaction committer that is executing the transaction</param>
 protected internal override void UpdateObjectBeforePersisting(ITransactionCommitter transactionCommitter)
 {
     _updateBeforePersistingExecuted = true;
 }
 ///<summary>
 /// Executes any custom code required by the business object before it is persisted to the database.
 /// This has the additionl capability of creating or updating other business objects and adding these
 /// to the transaction committer.
 /// <remarks> Recursive call to UpdateObjectBeforePersisting will not be done i.e. it is the bo developers responsibility to implement</remarks>
 ///</summary>
 ///<param name="transactionCommitter">the transaction committer that is executing the transaction</param>
 protected internal override void UpdateObjectBeforePersisting(ITransactionCommitter transactionCommitter)
 {
     _updateBeforePersistingExecuted = true;
 }
 ///<summary>
 /// Executes any custom code required by the business object before it is persisted to the database.
 /// This has the additionl capability of creating or updating other business objects and adding these
 /// to the transaction committer.
 ///</summary>
 ///<param name="transactionCommitter">the transaction committer that is executing the transaction</param>
 protected internal virtual void UpdateObjectBeforePersisting(ITransactionCommitter transactionCommitter)
 {
     _businessObject.UpdateObjectBeforePersisting(transactionCommitter);
 }
 /// <summary>
 /// Steps to carry out before the Save() command is run. You can add objects to the current
 /// transaction using this method, such as a database number generator.  No validity checks are
 /// made to the BusinessObject after this step, so be careful not to invalidate the object.
 /// </summary>
 /// <param name="transactionCommitter">The current transaction committer - any objects added to this will
 /// be committed in the same transaction as this one.</param>
 protected internal override void UpdateObjectBeforePersisting(ITransactionCommitter transactionCommitter)
 {
     transactionCommitter.AddBusinessObject(new FakeBOWithUpdateBeforePersisting());
 }
Exemple #41
0
 private void RunIncrementalImport(ITransactionCommitter transactionComitter, string filename, int impNr)
 {
     runImport(transactionComitter, filename, impNr, importType.Incremental);
 }