We have been discussing transactions and their disposal quite a bit recently, with lots of interesting input from Guy Robinson and Arnošt Löbel.
They just submitted comments on EditFamily requiring a non-modifiable document which highlight another issue in this area worthwhile promoting to a post of its own to ensure that you take notice:
Guy says: ... maybe it's time to recommend using the Manual transaction mode only and the removal of Automatic mode. This would pave the way for removing the transaction and regeneration attributes all together.
Jeremy says: I personally never use automatic transaction mode, but I do use both the manual and read-only ones.
It would actually be interesting to know the exact difference between an external command using read-only mode and one using manual without opening any transactions.
Arnošt says: I believe I said it publicly before, but probably not on this blog yet:
First of all, Automatic Transaction Mode is considered obsolete, and we (Autodesk.Revit) do not recommend using it for new external applications. It only exists to ensure compatibility with older applications. The Automatic mode has many limitations (for what an external command can or cannot do), while it has virtually no benefits whatsoever. It is likely it will go away in some future release of Revit.
Read-Only transaction mode does two things (well, it's one thing, really, but I'll split it):
All this basically guarantees that during the entire execution of the external command the current models all remain unmodified.
Guy sums up enthusiastically: Yes, I've been a manual transaction person for a long time.
For various reasons, this enjoyable and thought provoking discussion has accelerated a process I have been slowly going through since the R13 alpha's. The richness of the R13 API effected a rethink, and issues such as transactions/exceptions, which I'll admit I hadn't changed my approach to for a very long time, are triggering more fundamental changes in attitude to the API.
I'd have to say compared to the R8 API I first played with a very long time ago, the speed, stability and functionality possible now is quite stunning. And thinking why these scoping and other changes could be happening is making me rather excited.
With Win8/WinRT/iOS/mobile etc., though, apart from keeping it all logically in my brain it all makes for exciting times as a programmer, even if there aren't enough hours in the day ;-)
Jeremy says: Wow, yes, talking about cloud and mobile computing and enough hours in the day, have you looked at Kean's latest posts on creating a 3D Android viewer, calling a web-service from Unity, etc.?
Many thanks to Guy and Arnošt for this and all the other recent interesting discussions and insights!