Trx rollback question

Trx rollback question

Old forum URL: forums.lhotka.net/forums/t/6007.aspx


BuckeyeJeff posted on Wednesday, December 17, 2008

I have a function that does an update and it also calls child updates.  I am forcing an error on a child to see if everything rollsback and it is not.  all i have is this:   [Transactional(TransactionalTypes.TransactionScope)] at my root save method.  Is there something else I need?

 

    [Transactional(TransactionalTypes.TransactionScope)]
           public void SaveObject(GLEventInfo origObject)
           {
              

ajj3085 replied on Wednesday, December 17, 2008

The attribute should be applied to your root object's DataPortal_Insert / DataPortal_Update methods.

BuckeyeJeff replied on Wednesday, December 17, 2008

thanks, I did just that, but it doesn't appear to roll back my data that saves successfully.

 

 [Transactional(TransactionalTypes.TransactionScope)]
           protected override void DataPortal_Update()
           {
               ValidationRules.CheckRules();
               SomeObject origObject = this.m_origObject;
                    using (DAL.FServicesData service = new DAL.FServicesData())
                   {
                       service.SaveEvent(this);

                       History.Save(); // forced Error happens in here
                   }
               }
           }

ajj3085 replied on Wednesday, December 17, 2008

Without knowing what History.Save does, I think I can tell you why it's not working. 

BuckeyeJeff replied on Wednesday, December 17, 2008

   public GLHistoryList History
        {
            get
            {
                CanReadProperty("History", true);
                return m_history;
            }

        }

 

 protected override void DataPortal_Update()
            {
                this.RaiseListChangedEvents = true;
                Child_Update();
                this.RaiseListChangedEvents = false;
            }

 

  private void Child_Insert()
        {
            DAL.FinancialServicesData.AddGLHistoryEvent(this);
        }

BuckeyeJeff replied on Thursday, December 18, 2008

Incase anyone see's this post.  I have found my issue.  My entry point needed a dataportal method.  Using a custom method cause the transaction process to not work.  In short, use the data portal methods as much as  possible

Copyright (c) Marimer LLC