Author Topic: Witches, Ghosts, and Transactions  (Read 8113 times)

0 Members and 1 Guest are viewing this topic.

Micaletti

  • Guest
Re: Witches, Ghosts, and Transactions
« Reply #15 on: April 17, 2013, 10:42:19 AM »
Are we talking about transactions inside an event handler, or event handlers that call methods which start transactions, or both?

Specifically Editor.EnteringQuiescentState. Inside the handler I have code that may or may not call methods that start traditional transactions. Is that a nono?

EDIT:
The first thing I do in the handler is remove the handler.
« Last Edit: April 17, 2013, 10:47:13 AM by Micaletti »

TheMaster

  • Guest
Re: Witches, Ghosts, and Transactions
« Reply #16 on: April 20, 2013, 03:22:47 PM »
Are we talking about transactions inside an event handler, or event handlers that call methods which start transactions, or both?

Specifically Editor.EnteringQuiescentState. Inside the handler I have code that may or may not call methods that start traditional transactions. Is that a nono?

EDIT:
The first thing I do in the handler is remove the handler.

I can't say for sure, but I'd bet that it may cause problems with UNDO/REDO, because a 'traditional' transaction is actually an encapsulation of an undo group (e.g., UNDO Begin/End), so you might want to check to see if whatever you're doing (that is, if you're modifying something as opposed to only reading) is being undone/redone as a separate group, or is being undone/redone together with any changes made by a command that is ending.

The basic problem with using transactions in events like the one you cite is that it can result in the creation of a distinct undo group, while the intent may have been for the changes made to be undone/redone along with any changes made by a command that is ending when the event fired.

Micaletti

  • Guest
Re: Witches, Ghosts, and Transactions
« Reply #17 on: April 20, 2013, 04:17:07 PM »
Ah, thanks for the insight. So far my transactions are being undone along with the command that ended which is desired in my case but it's good to know that it's something to watch out for.

TheMaster

  • Guest
Re: Witches, Ghosts, and Transactions
« Reply #18 on: April 21, 2013, 11:06:12 AM »
Ah, thanks for the insight. So far my transactions are being undone along with the command that ended which is desired in my case but it's good to know that it's something to watch out for.

If I recall correctly, the times that I've tried to do stuff in events like BeginQuiescentState, it resulted in disabling REDO.  The changes were still Undone along with the changes made by the command that had just ended, and the user was able to UNDO them, but could not REDO them, so that's something you might want to check.

Micaletti

  • Guest
Re: Witches, Ghosts, and Transactions
« Reply #19 on: April 24, 2013, 01:10:58 PM »
My transactions UNDO/REDO as expected however I did not take any extra steps to make that happen. I suspect it may have something to do with the fact that I am almost exclusively working with the ACA/MEP API in these transactions.