• Industries
  • Products
  • Buy
  • Services & Support
  • Communities
  • Discussion Groups

    .NET

    Reply
    *Tony Tanzillo

    Transaction ended?

    87 Views, 3 Replies
    06-09-2005 03:37 PM
    Is there an 'official' way to find out if a Transaction has
    ended (aborted or commited) ?

    It looks like DisposableWrapper.get_AutoDelete() is one
    way to tell, but seems a bit flimsy.

    And, why doesn't TransactionManager expose any of the
    AcTransactionReactor notifications?


    --
    http://www.caddzone.com

    AcadXTabs: MDI Document Tabs for AutoCAD 2004/2005/2006
    http://www.acadxtabs.com
    Please use plain text.
    *Albert Szilvasy

    Re: Transaction ended?

    06-09-2005 06:55 PM in reply to: *Tony Tanzillo
    I would use AutoDelete. What is the context when you need this?

    The notifications are not there because you have to draw a line somewhere if
    you want to ship software.:-)

    Albert

    "Tony Tanzillo" wrote in message
    news:4871095@discussion.autodesk.com...
    Is there an 'official' way to find out if a Transaction has
    ended (aborted or commited) ?

    It looks like DisposableWrapper.get_AutoDelete() is one
    way to tell, but seems a bit flimsy.

    And, why doesn't TransactionManager expose any of the
    AcTransactionReactor notifications?


    --
    http://www.caddzone.com

    AcadXTabs: MDI Document Tabs for AutoCAD 2004/2005/2006
    http://www.acadxtabs.com
    Please use plain text.
    *Tony Tanzillo

    Re: Transaction ended?

    06-09-2005 09:32 PM in reply to: *Tony Tanzillo
    "Albert Szilvasy" wrote in message news:4871184@discussion.autodesk.com...

    >> I would use AutoDelete. What is the context when you need this?

    If another transaction was started before mine (an
    "outer" transaction), my transaction can be aborted
    by an action beyond my control. I just want to be
    able to know if that happened.

    >> The notifications are not there because you have to
    >> draw a line somewhere if you want to ship software.:-)

    The need for transaction events was related to finding out
    if a transaction wrapped by the managed Transaction class
    was ended.

    I have a class that manages a transaction for clients, and
    exposes methods to Start/Commit/Abort it. But, clients may
    need to use GetObject on the transaction, so I need to
    expose the Transaction member to them (or aggregate the
    GetObject member and whatever else they need). Exposing
    the contained Transaction object directly also means clients
    can commit or abort it without my class knowing about it.

    --
    http://www.caddzone.com

    AcadXTabs: MDI Document Tabs for AutoCAD 2004/2005/2006
    http://www.acadxtabs.com
    Please use plain text.
    *Tony Tanzillo

    Re: Transaction ended?

    06-10-2005 04:58 PM in reply to: *Tony Tanzillo
    "Albert Szilvasy" wrote

    >> I would use AutoDelete. What is the context when you need this?

    See System.ComponentModel.Design.DesignerTransaction

    On further reflection, AutoDelete really doesn't solve the problem,
    and neither do events that notify me that a transaction has ended.

    Consider this:

    Transaction trOuterMost = .StartTransaction(); // client does this
    {
    // do stuff here
    Transaction trMiddle = .StartTransaction(); // client does this
    {
    // do more stuff here....
    // I need to know if the following was aborted:
    Transaction trInnerMost = .StartTransaction(); // I do this
    {
    // Do stuff here


    trOuterMost.Abort(); // client gets control (via an event)
    // and does this, which
    // aborts all of the above.

    If I'm not mistaken, AutoDelete will not reflect the fact that the
    wrapped AcDbTransactions for all but the one whose Abort()
    member was called, have ended. But perhaps I'm wrong?

    After giving it just a little thought, it looks like the critical
    notifications that we actually need are not transactionAborted()
    or transactionEnded() (these can be rendered as properties).

    What we really need are transactionAboutToEnd/Abort() because
    my situation requires me to take certain actions within the ending
    transaction's boundary. The basic problem stems from the fact
    that when I fire events at the client, they get control within the
    boundary of my 'innermost' transaction, which allows them to
    abort an outer transaction, along with all others started after it.


    --
    http://www.caddzone.com

    AcadXTabs: MDI Document Tabs for AutoCAD 2004/2005/2006
    http://www.acadxtabs.com


    The notifications are not there because you have to draw a line somewhere if
    you want to ship software.:-)

    Albert

    "Tony Tanzillo" wrote in message
    news:4871095@discussion.autodesk.com...
    Is there an 'official' way to find out if a Transaction has
    ended (aborted or commited) ?

    It looks like DisposableWrapper.get_AutoDelete() is one
    way to tell, but seems a bit flimsy.

    And, why doesn't TransactionManager expose any of the
    AcTransactionReactor notifications?


    --
    http://www.caddzone.com

    AcadXTabs: MDI Document Tabs for AutoCAD 2004/2005/2006
    http://www.acadxtabs.com
    Please use plain text.