<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Can I start transactions inside the Application.Idle event without bothering the redo buffer? in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/can-i-start-transactions-inside-the-application-idle-event/m-p/12523095#M5742</link>
    <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/8575899"&gt;@daniel_cadext&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;&lt;P&gt;Transactions aren’t required, you can do things without using a transaction, you just have to manage disposing&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;Hmm... interesting.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Unfortunately I have a bunch of helper methods that rely on a transaction being there. They manage both a global dictionary and entity dictionaries, and the first time they are used they create the dictionaries.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So, in order to work without transaction, I will need to either get the OnIdle to not use those helper functions (which is the best way to create unmaintainable code and hit a wall of bugs the first time I modify those helper functions) or to add an optional WithoutTransaction argument to those functions (or to abort if the transaction doesn't exist and the dictionary is not found).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This will require some heavy refactoring of functions that are used everywhere, and right now I don't have the time for it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for the pointer, I will keep it in mind when I will find the time to work on it.&lt;/P&gt;&lt;P&gt;For now I will modify the timer to do the cleanup once every 30 minutes.&lt;/P&gt;</description>
    <pubDate>Sat, 27 Jan 2024 02:15:31 GMT</pubDate>
    <dc:creator>stefanome</dc:creator>
    <dc:date>2024-01-27T02:15:31Z</dc:date>
    <item>
      <title>Can I start transactions inside the Application.Idle event without bothering the redo buffer?</title>
      <link>https://forums.autodesk.com/t5/net-forum/can-i-start-transactions-inside-the-application-idle-event/m-p/12522905#M5740</link>
      <description>&lt;P&gt;My addin creates some geometries and stores some metadata in the NOD.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If the user deletes the geometries, stale metadata remains in the NOD, so I&amp;nbsp;have created an housekeeping event that ever 30 seconds checks for and deletes any stale data.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The checking for requires starting a transaction.&lt;/P&gt;&lt;P&gt;Most of the times there is nothing to delete and the transaction is aborted.&lt;/P&gt;&lt;P&gt;Sometimes there is something to delete and the transaction is committed.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It looks like the redo buffer is lost every time a transaction is started, regardless of whether the transaction is committed or not.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there a way to do some housekeeping that requires starting a transaction without resetting the redo buffer?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is how the event works:&lt;/P&gt;&lt;DIV&gt;&lt;PRE&gt;&lt;SPAN&gt;public class MyAddin: IExtensionApplication&lt;BR /&gt;{&lt;BR /&gt;    public void Initialize()&lt;BR /&gt;    {&lt;BR /&gt;        Application.Idle += OnIdle;&lt;BR /&gt;    }&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;public static void &lt;/SPAN&gt;&lt;SPAN&gt;OnIdle&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;object &lt;/SPAN&gt;&lt;SPAN&gt;sender, &lt;/SPAN&gt;&lt;SPAN&gt;EventArgs &lt;/SPAN&gt;&lt;SPAN&gt;e)&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;{&lt;BR /&gt;&lt;/SPAN&gt;    &lt;SPAN&gt;if &lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;_dwg &lt;/SPAN&gt;&lt;SPAN&gt;== &lt;/SPAN&gt;&lt;SPAN&gt;null &lt;/SPAN&gt;&lt;SPAN&gt;|| &lt;/SPAN&gt;!_dwg.Editor&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;IsQuiescent) &lt;/SPAN&gt;&lt;SPAN&gt;return&lt;/SPAN&gt;&lt;SPAN&gt;;&lt;BR /&gt;&lt;/SPAN&gt;    &lt;SPAN&gt;if &lt;/SPAN&gt;&lt;SPAN&gt;((&lt;/SPAN&gt;&lt;SPAN&gt;DateTime&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;Now &lt;/SPAN&gt;&lt;SPAN&gt;- &lt;/SPAN&gt;&lt;SPAN&gt;lastOnIdleExecution&lt;/SPAN&gt;&lt;SPAN&gt;).&lt;/SPAN&gt;&lt;SPAN&gt;TotalSeconds &lt;/SPAN&gt;&lt;SPAN&gt;&amp;lt; &lt;/SPAN&gt;&lt;SPAN&gt;30&lt;/SPAN&gt;&lt;SPAN&gt;) &lt;/SPAN&gt;&lt;SPAN&gt;return&lt;/SPAN&gt;&lt;SPAN&gt;;&lt;BR /&gt;&lt;/SPAN&gt;    &lt;SPAN&gt;lastOnIdleExecution &lt;/SPAN&gt;&lt;SPAN&gt;= &lt;/SPAN&gt;&lt;SPAN&gt;DateTime&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;Now&lt;/SPAN&gt;&lt;SPAN&gt;;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;BR /&gt;&lt;/SPAN&gt;    &lt;SPAN&gt;// delete grid global properties entry for grids that have been deleted&lt;BR /&gt;&lt;/SPAN&gt;    &lt;SPAN&gt;using var &lt;/SPAN&gt;&lt;SPAN&gt;trans = &lt;/SPAN&gt;&lt;SPAN&gt;Dwg&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;TransactionManager&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;StartTransaction&lt;/SPAN&gt;&lt;SPAN&gt;();&lt;BR /&gt;&lt;/SPAN&gt;    // check for stale data and delete+commit only if necessary&lt;BR /&gt;}&lt;/PRE&gt;&lt;/DIV&gt;</description>
      <pubDate>Fri, 26 Jan 2024 22:38:36 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/can-i-start-transactions-inside-the-application-idle-event/m-p/12522905#M5740</guid>
      <dc:creator>stefanome</dc:creator>
      <dc:date>2024-01-26T22:38:36Z</dc:date>
    </item>
    <item>
      <title>Re: Can I start transactions inside the Application.Idle event without bothering the redo buffer?</title>
      <link>https://forums.autodesk.com/t5/net-forum/can-i-start-transactions-inside-the-application-idle-event/m-p/12523035#M5741</link>
      <description>&lt;P&gt;That’s kindof the whole idea behind transactions.&lt;/P&gt;&lt;P&gt;Transactions aren’t required, you can do things without using a transaction, you just have to manage disposing&lt;/P&gt;&lt;P&gt;Not sure if this exposed to .NET, but maybe you can toggle AcDbDatabase::disableUndoRecording&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 27 Jan 2024 00:42:18 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/can-i-start-transactions-inside-the-application-idle-event/m-p/12523035#M5741</guid>
      <dc:creator>daniel_cadext</dc:creator>
      <dc:date>2024-01-27T00:42:18Z</dc:date>
    </item>
    <item>
      <title>Re: Can I start transactions inside the Application.Idle event without bothering the redo buffer?</title>
      <link>https://forums.autodesk.com/t5/net-forum/can-i-start-transactions-inside-the-application-idle-event/m-p/12523095#M5742</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/8575899"&gt;@daniel_cadext&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;&lt;P&gt;Transactions aren’t required, you can do things without using a transaction, you just have to manage disposing&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;Hmm... interesting.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Unfortunately I have a bunch of helper methods that rely on a transaction being there. They manage both a global dictionary and entity dictionaries, and the first time they are used they create the dictionaries.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So, in order to work without transaction, I will need to either get the OnIdle to not use those helper functions (which is the best way to create unmaintainable code and hit a wall of bugs the first time I modify those helper functions) or to add an optional WithoutTransaction argument to those functions (or to abort if the transaction doesn't exist and the dictionary is not found).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This will require some heavy refactoring of functions that are used everywhere, and right now I don't have the time for it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for the pointer, I will keep it in mind when I will find the time to work on it.&lt;/P&gt;&lt;P&gt;For now I will modify the timer to do the cleanup once every 30 minutes.&lt;/P&gt;</description>
      <pubDate>Sat, 27 Jan 2024 02:15:31 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/can-i-start-transactions-inside-the-application-idle-event/m-p/12523095#M5742</guid>
      <dc:creator>stefanome</dc:creator>
      <dc:date>2024-01-27T02:15:31Z</dc:date>
    </item>
    <item>
      <title>Re: Can I start transactions inside the Application.Idle event without bothering the redo buffer?</title>
      <link>https://forums.autodesk.com/t5/net-forum/can-i-start-transactions-inside-the-application-idle-event/m-p/12523113#M5743</link>
      <description>&lt;P&gt;So long as AutoCAD is in a quiescent state, I would expect that the code wouldn't screw-up undo, but it would most-likely result in the changes you make being treated as a separate undoable action, requiring the user to issue an extra 'U' to undo back to the point before the changes were made. You could try using an OpenCloseTransaction instead of a regular transaction to see if that has any effect, but your code would also have to lock the document.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This executes your code inside the handler of a registered command, but will also most-likely result in a separate UNDO group, but you can give it a try and test to see what happens:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;public static void OnIdle(object sender, EventArgs e)
{
   if(_dwg == null || !_dwg.Editor.IsQuiescent) return;
   if((DateTime.Now - lastOnIdleExecution).TotalSeconds &amp;lt; 30) return;
   lastOnIdleExecution = DateTime.Now;
   var docs = Application.DocumentManager;
   docs.ExecuteInCommandContextAsync(unused =&amp;gt;
   {
      using(var tr = new OpenCloseTransaction())
      {
         // check for stale data and delete+commit only if necessary
         tr.Commit();
         return null;
      }
   }, null);
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 27 Jan 2024 02:51:15 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/can-i-start-transactions-inside-the-application-idle-event/m-p/12523113#M5743</guid>
      <dc:creator>ActivistInvestor</dc:creator>
      <dc:date>2024-01-27T02:51:15Z</dc:date>
    </item>
    <item>
      <title>Re: Can I start transactions inside the Application.Idle event without bothering the redo buffer?</title>
      <link>https://forums.autodesk.com/t5/net-forum/can-i-start-transactions-inside-the-application-idle-event/m-p/12523117#M5744</link>
      <description>&lt;P&gt;Thank you for your pointer.&lt;/P&gt;&lt;P&gt;It's Friday night and I will try this on Monday.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/4476837"&gt;@ActivistInvestor&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;&lt;P&gt;So long as AutoCAD is in a quiescent state, I would expect that the code wouldn't screw-up undo&lt;/P&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;I just wanted to point our that the undo is not screwed up, it's the redo. But&amp;nbsp;I imagine that you understood that, and you just shortened "undo/redo" into "undo".&lt;/P&gt;</description>
      <pubDate>Sat, 27 Jan 2024 02:59:21 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/can-i-start-transactions-inside-the-application-idle-event/m-p/12523117#M5744</guid>
      <dc:creator>stefanome</dc:creator>
      <dc:date>2024-01-27T02:59:21Z</dc:date>
    </item>
    <item>
      <title>Re: Can I start transactions inside the Application.Idle event without bothering the redo buffer?</title>
      <link>https://forums.autodesk.com/t5/net-forum/can-i-start-transactions-inside-the-application-idle-event/m-p/12523337#M5745</link>
      <description>&lt;P&gt;Yes, when I said undo I meant both undo and redo. And it is the latter of that usually gets messed up.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regarding &lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/8575899"&gt;@daniel_cadext&lt;/a&gt;'s comment, when you use an OpenCloseTransaction, you aren't using transactions. An OpenCloseTransaction really isn't a transaction in the same sense as that returned by StartTransaction().&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It uses the open/close mechanism and so it just calls AcDbObject::close()/cancel() on each object from Commit()/Abort().&lt;/P&gt;</description>
      <pubDate>Sat, 27 Jan 2024 09:00:53 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/can-i-start-transactions-inside-the-application-idle-event/m-p/12523337#M5745</guid>
      <dc:creator>ActivistInvestor</dc:creator>
      <dc:date>2024-01-27T09:00:53Z</dc:date>
    </item>
    <item>
      <title>Re: Can I start transactions inside the Application.Idle event without bothering the redo buffer?</title>
      <link>https://forums.autodesk.com/t5/net-forum/can-i-start-transactions-inside-the-application-idle-event/m-p/12523368#M5746</link>
      <description>&lt;P&gt;"which is the best way to create unmaintainable code and hit a wall of bugs the first time I modify those helper functions"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Yep, using onidle is a bit kludgy.&amp;nbsp; A better option might be to use events, or use ObjectOverrule to cleanup on erase&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 27 Jan 2024 09:09:51 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/can-i-start-transactions-inside-the-application-idle-event/m-p/12523368#M5746</guid>
      <dc:creator>daniel_cadext</dc:creator>
      <dc:date>2024-01-27T09:09:51Z</dc:date>
    </item>
    <item>
      <title>Re: Can I start transactions inside the Application.Idle event without bothering the redo buffer?</title>
      <link>https://forums.autodesk.com/t5/net-forum/can-i-start-transactions-inside-the-application-idle-event/m-p/12523372#M5747</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/909070"&gt;@stefanome&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/8575899"&gt;@daniel_cadext&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;&lt;P&gt;Transactions aren’t required, you can do things without using a transaction, you just have to manage disposing&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;Hmm... interesting.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Unfortunately I have a bunch of helper methods that rely on a transaction being there. They manage both a global dictionary and entity dictionaries, and the first time they are used they create the dictionaries.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So, in order to work without transaction, I will need to either get the OnIdle to not use those helper functions (which is the best way to create unmaintainable code and hit a wall of bugs the first time I modify those helper functions) or to add an optional WithoutTransaction argument to those functions (or to abort if the transaction doesn't exist and the dictionary is not found).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This will require some heavy refactoring of functions that are used everywhere, and right now I don't have the time for it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;You don't have to go through all of the refactoring.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;As I explained above, an OpenCloseTransaction really isn't a transaction, so when you use that in place of the Transaction returned by StartTransaction(), you aren't using transactions at all. OpenCloseTransaction uses the&amp;nbsp; native equivalents of ObjectId.Open(), DBObject.Close() and DBObject.Cancel(), and was designed precisely for the situation you have, as it allows you to avoid using regular transactions that interfere with undo/redo.&lt;/P&gt;</description>
      <pubDate>Sat, 27 Jan 2024 20:40:36 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/can-i-start-transactions-inside-the-application-idle-event/m-p/12523372#M5747</guid>
      <dc:creator>ActivistInvestor</dc:creator>
      <dc:date>2024-01-27T20:40:36Z</dc:date>
    </item>
    <item>
      <title>Re: Can I start transactions inside the Application.Idle event without bothering the redo buffer?</title>
      <link>https://forums.autodesk.com/t5/net-forum/can-i-start-transactions-inside-the-application-idle-event/m-p/12523493#M5748</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/909070"&gt;@stefanome&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Unfortunately I have a bunch of helper methods that rely on a transaction being there. They manage both a global dictionary and entity dictionaries, and the first time they are used they create the dictionaries.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;[...]&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This will require some heavy refactoring of functions that are used everywhere, and right now I don't have the time for it.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;In addition to &lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/8575899"&gt;@daniel_cadext&lt;/a&gt; and &lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/4476837"&gt;@ActivistInvestor&lt;/a&gt; replies, if you use an OpenCloseTransaction, the refactoring would be passing this 'transaction' as argument to the hepler methods because it is not considered a 'TopTransaction'.&lt;/P&gt;</description>
      <pubDate>Sat, 27 Jan 2024 11:55:16 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/can-i-start-transactions-inside-the-application-idle-event/m-p/12523493#M5748</guid>
      <dc:creator>_gile</dc:creator>
      <dc:date>2024-01-27T11:55:16Z</dc:date>
    </item>
    <item>
      <title>Re: Can I start transactions inside the Application.Idle event without bothering the redo buffer?</title>
      <link>https://forums.autodesk.com/t5/net-forum/can-i-start-transactions-inside-the-application-idle-event/m-p/12526907#M5749</link>
      <description>&lt;P&gt;All my commands (including the OnIdle event) start by using my EntityProperty class to check some global info stored in the drawing. Some commands will also generate new info, other commands (including the OnIdle event) will only read existing info.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is one of EntityProperty's members:&lt;/P&gt;&lt;DIV&gt;&lt;PRE&gt;&lt;SPAN&gt;public static &lt;/SPAN&gt;&lt;SPAN&gt;Dictionary&lt;/SPAN&gt;&lt;SPAN&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN&gt;string&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;object&lt;/SPAN&gt;&lt;SPAN&gt;&amp;gt; &lt;/SPAN&gt;&lt;SPAN&gt;GetGlobalProperties&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;Document &lt;/SPAN&gt;&lt;SPAN&gt;dwg)&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;{&lt;BR /&gt;&lt;/SPAN&gt;    &lt;SPAN&gt;var &lt;/SPAN&gt;&lt;SPAN&gt;dbDict = dwg.&lt;/SPAN&gt;&lt;SPAN&gt;Database&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;GetNOD&lt;/SPAN&gt;&lt;SPAN&gt;().&lt;/SPAN&gt;&lt;SPAN&gt;GetOrCreateNamedDictionary&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;GlobalDictName&lt;/SPAN&gt;&lt;SPAN&gt;);&lt;BR /&gt;&lt;/SPAN&gt;    &lt;SPAN&gt;return &lt;/SPAN&gt;&lt;SPAN&gt;DbDictionaryToDictionary&lt;/SPAN&gt;&lt;SPAN&gt;(dbDict);&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;}&lt;BR /&gt;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;/DIV&gt;&lt;P&gt;Here I call&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/109424"&gt;@_gile&lt;/a&gt;'s very own Database.GetNOD, which calls ObjectId.GetObject, which calls&amp;nbsp;Database.GetTopTransaction, which relies on a transaction.&lt;/P&gt;&lt;P&gt;Then, I call&amp;nbsp;DBDictionary.GetOrCreateNamedDictionary, which again calls&amp;nbsp;Database.GetTopTransaction.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I see one two-step approach, which includes some heavy refactoring:&lt;/P&gt;&lt;P&gt;1. Rewriting all Gilles' extensions and creating a read only version that doesn't use transactions&lt;/P&gt;&lt;P&gt;2.&amp;nbsp;Adding the second readOnly argument too all the methods of my EntityProperty class, something like&amp;nbsp;GetGlobalProperties(Document dwg, bool readOnly=false), and then, if readOnly==true, using the new readOnly extensions&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can you suggest a better approach?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I saw&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/8575899"&gt;@daniel_cadext&lt;/a&gt;'s suggestion: "&lt;SPAN&gt;use ObjectOverrule to cleanup on erase", but it feels wrong running some code every time any object in the drawing is erased. If the user deletes thousands of entities with one single click, I would run my checks thousands of times, and the checks could be slow.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Perhaps I could use the&amp;nbsp;ObjectOverrule to set a global somethingHasBeenErased=true, then use the OnIdle to only do its job, including risking of breaking the redo buffer, only if&amp;nbsp;somethingHasBeenErased==true?&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 29 Jan 2024 16:15:53 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/can-i-start-transactions-inside-the-application-idle-event/m-p/12526907#M5749</guid>
      <dc:creator>stefanome</dc:creator>
      <dc:date>2024-01-29T16:15:53Z</dc:date>
    </item>
    <item>
      <title>Re: Can I start transactions inside the Application.Idle event without bothering the redo buffer?</title>
      <link>https://forums.autodesk.com/t5/net-forum/can-i-start-transactions-inside-the-application-idle-event/m-p/12527077#M5750</link>
      <description>&lt;P&gt;I generally make it a rule to avoid dependence on the top transaction. Most if not all of the methods I write that use transactions will take a transaction as an argument so that I can pass them a regular transaction or an OpenCloseTransaction, depending on the situation, which will dictate which type of transaction is needed or required.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;As far as watching for Erasure of objects, you could use the events of DBObject which are reactors that are attached to individual objects, so you do not get notified about every object in the database, only the ones that you attach the event handlers to.&lt;/P&gt;</description>
      <pubDate>Mon, 29 Jan 2024 17:33:00 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/can-i-start-transactions-inside-the-application-idle-event/m-p/12527077#M5750</guid>
      <dc:creator>ActivistInvestor</dc:creator>
      <dc:date>2024-01-29T17:33:00Z</dc:date>
    </item>
    <item>
      <title>Re: Can I start transactions inside the Application.Idle event without bothering the redo buffer?</title>
      <link>https://forums.autodesk.com/t5/net-forum/can-i-start-transactions-inside-the-application-idle-event/m-p/12527092#M5751</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/4476837"&gt;@ActivistInvestor&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;&lt;P&gt;I generally make it a rule to avoid dependence on the top transaction. Most if not all of the methods I write that use transactions will take a transaction as an argument so that I can pass them a regular transaction or an OpenCloseTransaction, depending on the situation, which will dictate which type of transaction is needed or required.&lt;/P&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;This would require refactoring Gilles extensions, but (1) I would have only one version (vs one read only plus one read and write) and (2) It would be clear what I do when I do it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/4476837"&gt;@ActivistInvestor&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;&lt;P&gt;As far as watching for Erasure of objects, you could use the events of DBObject which are reactors that are attached to individual objects, so you do not get notified about every object in the database, only the ones that you attach the event handlers to.&lt;/P&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;Do you mean I should setup the event on the objects (1) when I created them and (2) when I open a drawing, by scanning the drawing for already existing objects?&lt;/P&gt;&lt;P&gt;This would&amp;nbsp; require one scan at drawing opening, much better than what I'm doing now, that is one scan every few minutes in the OnIdle event.&lt;/P&gt;</description>
      <pubDate>Mon, 29 Jan 2024 17:41:13 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/can-i-start-transactions-inside-the-application-idle-event/m-p/12527092#M5751</guid>
      <dc:creator>stefanome</dc:creator>
      <dc:date>2024-01-29T17:41:13Z</dc:date>
    </item>
    <item>
      <title>Re: Can I start transactions inside the Application.Idle event without bothering the redo buffer?</title>
      <link>https://forums.autodesk.com/t5/net-forum/can-i-start-transactions-inside-the-application-idle-event/m-p/12527232#M5752</link>
      <description>&lt;P&gt;You do not need to re-write all the extension methods.&lt;/P&gt;
&lt;P&gt;You can simply write 'classical' code to acces to DBObjects from an OpenCloseTransaction:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="csharp"&gt;public static Dictionary&amp;lt;string, object&amp;gt; GetGlobalProperties(Document dwg)
{
    var db = dwg.Database;
    using (var tr = db.TransactionManager.StartOpenCloseTransaction())
    {
        var nod = (DBDictionary)tr.GetObject(db.NamedObjectsDictionaryId, OpenMode.ForRead);
        DBDictionary dbDict;
        if (nod.Contains(GlobalDictName))
        {
            dbDict = (DBDictionary)tr.GetObject(nod.GetAt(GlobalDictName), OpenMode.ForRead);
        }
        else
        {
            nod.UpgradeOpen();
            dbDict = new DBDictionary();
            nod.SetAt(GlobalDictName, dbDict);
            tr.AddNewlyCreatedDBObject(dbDict, true);
        }
        return DbDictionaryToDictionary(dbDict, tr);
    }
}&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Or no transaction:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="csharp"&gt;#pragma warning disable 0618
        public static Dictionary&amp;lt;string, object&amp;gt; GetGlobalProperties(Document dwg)
        {
            var db = dwg.Database;
            using (var nod = (DBDictionary)db.NamedObjectsDictionaryId.Open(OpenMode.ForRead))
            {
                DBDictionary dbDict;
                if (nod.Contains(GlobalDictName))
                {
                    dbDict = (DBDictionary)nod.GetAt(GlobalDictName).Open(OpenMode.ForRead);
                }
                else
                {
                    nod.UpgradeOpen();
                    dbDict = new DBDictionary();
                    nod.SetAt(GlobalDictName, dbDict);
                }
                return DbDictionaryToDictionary(dbDict);
            }
        }
    }
#pragma warning restore 0618&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 29 Jan 2024 19:56:07 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/can-i-start-transactions-inside-the-application-idle-event/m-p/12527232#M5752</guid>
      <dc:creator>_gile</dc:creator>
      <dc:date>2024-01-29T19:56:07Z</dc:date>
    </item>
    <item>
      <title>Re: Can I start transactions inside the Application.Idle event without bothering the redo buffer?</title>
      <link>https://forums.autodesk.com/t5/net-forum/can-i-start-transactions-inside-the-application-idle-event/m-p/12527577#M5753</link>
      <description>&lt;P&gt;I had never seen the ObjectID.Open, then I noticed that the IDE is reporting it as obsolete and it says I should use GetObject. I haven't tested, but I assume they are equivalent (maybe you are using Open simply because you are used to the old way).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Then I noticed that the Autodesk ObjectId.GetObject does not use a transaction while your extension&amp;nbsp;ObjectId.GetObject&amp;lt;T&amp;gt; does. I think this had created some confusion in my head, but now the fog is starting to clear up.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So I decided it was time to revisit the documentation. I studied it 2 years ago, then other priorities pulled me away, then I just restarted working with Autocad and I felt I knew enough, just because my commands were working well. Now that I am more familiar with the Autocad APIs in general, I will be able to better understand how transactions and object opening work.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I already found out that I missed tons of Dispose: the &lt;A href="https://help.autodesk.com/view/OARX/2023/ENU/?guid=GUID-9DFB5767-F8D6-4A88-87D6-9676C0189369" target="_blank" rel="noopener"&gt;documentation&lt;/A&gt; says I should dispose an object "Always with newly created database objects, objects derived from&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;DBObject, that are not added to the database", and I have functions like this Polyline extension that don't Dispose:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;public static int IsPointInside(this Polyline polyline, Point3d point)
{
    if (!polyline.Closed) throw new ArgumentException("Impossible to check if a point is inside an open polyline.");

    // return 0 if the point is on the polyline
    var closestPoint = polyline.GetClosestPointTo(point, false);
    if (closestPoint.IsEqualTo(point)) return 0;

    // return 1 if the point is inside, -1 if it's outside
    var length = polyline.Length + point.DistanceTo(polyline.StartPoint);
    var ray = new Line(point, point + new Vector3d(length, length * 0.1234, 0)); // using an unusual angle the chances of hitting a vertex are very low (and we are ignoring that occurrence... for now)
    var intersections = new Point3dCollection();
    polyline.IntersectWith(ray, Intersect.OnBothOperands, intersections, IntPtr.Zero, IntPtr.Zero);
    return intersections.Count % 2 == 0 ? -1 : 1;
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you all for your support.&lt;/P&gt;&lt;P&gt;I will take some time to study, digest, experiment, and finally proceed with the changes.&lt;/P&gt;</description>
      <pubDate>Mon, 29 Jan 2024 21:18:50 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/can-i-start-transactions-inside-the-application-idle-event/m-p/12527577#M5753</guid>
      <dc:creator>stefanome</dc:creator>
      <dc:date>2024-01-29T21:18:50Z</dc:date>
    </item>
    <item>
      <title>Re: Can I start transactions inside the Application.Idle event without bothering the redo buffer?</title>
      <link>https://forums.autodesk.com/t5/net-forum/can-i-start-transactions-inside-the-application-idle-event/m-p/12527586#M5754</link>
      <description>&lt;P&gt;You would have to add ha&lt;SPAN&gt;ndlers for the events when a drawing file is opened, and when you create new instances of those objects. Don't remove the handlers from the objects when they are erased because they could eventually be unerased and usually, handling erase also requires handling unerase.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 29 Jan 2024 21:16:39 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/can-i-start-transactions-inside-the-application-idle-event/m-p/12527586#M5754</guid>
      <dc:creator>ActivistInvestor</dc:creator>
      <dc:date>2024-01-29T21:16:39Z</dc:date>
    </item>
    <item>
      <title>Re: Can I start transactions inside the Application.Idle event without bothering the redo buffer?</title>
      <link>https://forums.autodesk.com/t5/net-forum/can-i-start-transactions-inside-the-application-idle-event/m-p/12527664#M5755</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/909070"&gt;@stefanome&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;I had never seen the ObjectID.Open, then I noticed that the IDE is reporting it as obsolete and it says I should use GetObject. I haven't tested, but I assume they are equivalent (maybe you are using Open simply because you are used to the old way).&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;The two codes I posted are equivalent. The OpenCloseTransaction is a wrapper for the Open / Dispose way which ensure the the DBObjects opened with or added to the OpenCloseTransaction are disposed when the transaction is disposed (this is why I use a 'using statement' for all objects opened with ObjectId.Open).&lt;/P&gt;
&lt;P&gt;I'm not 'used to the old way', I simply wanted to show how to doi it without a Transaction as suggested by &lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/8575899"&gt;@daniel_cadext&lt;/a&gt; in reply #2.&lt;/P&gt;
&lt;PRE class="lia-code-sample line-numbers language-csharp" tabindex="0"&gt;&lt;CODE&gt;#pragma warning disable 0618&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Is used to disable the "Obsolete, For advanced use only" warning.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/909070"&gt;@stefanome&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Then I noticed that the Autodesk ObjectId.GetObject does not use a transaction while your extension&amp;nbsp;ObjectId.GetObject&amp;lt;T&amp;gt; does. I think this had created some confusion in my head, but now the fog is starting to clear up.&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;ObjectId.GetObject does use the TopTransaction and will crash AutoCAD if there's none top transaction (ObjectId.GetObject&amp;lt;T&amp;gt; just throws an exception).&lt;/P&gt;
&lt;P&gt;The extension methods I've shared are just helpers to simplify the writing of certain common tasks in the usual situation where a top transaction exists. They do not dispense with the need to know how to open or create DBObjects in the classic way, as described in &lt;A href="https://help.autodesk.com/view/OARX/2023/ENU/?guid=GUID-774B7F11-E374-450B-9E2E-CAE02F4AADFE" target="_blank" rel="noopener"&gt;this section&lt;/A&gt;.&lt;/P&gt;</description>
      <pubDate>Mon, 29 Jan 2024 22:05:23 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/can-i-start-transactions-inside-the-application-idle-event/m-p/12527664#M5755</guid>
      <dc:creator>_gile</dc:creator>
      <dc:date>2024-01-29T22:05:23Z</dc:date>
    </item>
    <item>
      <title>Re: Can I start transactions inside the Application.Idle event without bothering the redo buffer?</title>
      <link>https://forums.autodesk.com/t5/net-forum/can-i-start-transactions-inside-the-application-idle-event/m-p/12527806#M5756</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/109424"&gt;@_gile&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/909070"&gt;@stefanome&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;&lt;P&gt;I had never seen the ObjectID.Open, then I noticed that the IDE is reporting it as obsolete and it says I should use GetObject. I haven't tested, but I assume they are equivalent (maybe you are using Open simply because you are used to the old way).&lt;/P&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;The two codes I posted are equivalent. The OpenCloseTransaction is a wrapper for the Open / Dispose way which ensure the the DBObjects opened with or added to the OpenCloseTransaction are disposed when the transaction is disposed (this is why I use a 'using statement' for all objects opened with ObjectId.Open).&lt;/P&gt;&lt;P&gt;I'm not 'used to the old way', I simply wanted to show how to doi it without a Transaction as suggested by &lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/8575899"&gt;@daniel_cadext&lt;/a&gt; in reply #2.&lt;/P&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/109424"&gt;@_gile&lt;/a&gt;. The two examples you posted are not exactly equivalent.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The difference between them. is what happens in the event that an exception causes control to prematurely exit the using() block that disposes the OpenCloseTransaction (in the first example) or the using() block that disposes the DBObject (in the second example).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;DBObject.Dispose() &lt;EM&gt;always&lt;/EM&gt; calls &lt;STRONG&gt;AcDbObject::close()&lt;/STRONG&gt;, which commits any changes made to the DBObject.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;OpenCloseTransaction.Dispose() &lt;EM&gt;without a prior call to Commit()&lt;/EM&gt;, calls &lt;STRONG&gt;AcDbObject::cancel()&lt;/STRONG&gt; on each DBObject opened with the Transaction, which discards any changes made to the objects (that example is missing the call to Transaction.Commit()&amp;nbsp; BTW, but I'm going on the assumption that it should).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So, in your first example (using OpenCloseTransaction), if an exception causes execution to exit the using() block before the call&amp;nbsp; to Commit() is reached, changes made to any DBObjects are rolled-back, whereas in your second example,&amp;nbsp;if an exception causes execution to exit the using() block, changes made to any DBObjects &lt;EM&gt;are not rolled-back&lt;/EM&gt;,&amp;nbsp; and instead are committed.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In order to make the two examples precisely-equivalent, you would need to refactor the second example, by placing all code that modifies the DBObject inside a try block that is followed by a catch() block that calls DBObject.Cancel(), and then rethrows the exception.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The general pattern would be:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;static void ModifyWithObjectIdOpen(ObjectId id)
{
   using(DBObject obj = id.Open(OpenMode.ForWrite, false, false))
   {
      try
      {
         /// all changes to the opened object must occur here
      }
      catch
      {
         obj.Cancel();
         throw;
      }
   }
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Which is &lt;EM&gt;precisely&lt;/EM&gt;-equivalent to:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;static void ModifyWithOpenCloseTransaction(ObjectId id)
{
   using(var tr = new OpenCloseTransaction())
   {
      DBObject obj = tr.GetObject(id, OpenMode.ForWrite, false, false));

      /// all changes to the opened object must occur here

      tr.Commit();
   }
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So in fact, using ObjectId.Open() to modify DBObjects is not as simple as it may first appear,&amp;nbsp; and is so much-more complicated that I strongly advise anyone to avoid using it it for anything but read-only purposes.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 30 Jan 2024 00:05:44 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/can-i-start-transactions-inside-the-application-idle-event/m-p/12527806#M5756</guid>
      <dc:creator>ActivistInvestor</dc:creator>
      <dc:date>2024-01-30T00:05:44Z</dc:date>
    </item>
    <item>
      <title>Re: Can I start transactions inside the Application.Idle event without bothering the redo buffer?</title>
      <link>https://forums.autodesk.com/t5/net-forum/can-i-start-transactions-inside-the-application-idle-event/m-p/12528457#M5757</link>
      <description>&lt;P&gt;it’s actually not rocket science. That’s how it’s done in ARX. I would argue that you should know how DBObjects behave if you want to be more than just a casual CAD programmer, and especially, if you are writing .NET modules professionally.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For those of us that started with .NET in back in 2005, this was the only way. It wasn’t until later that Autodesk realized the garbage collector was non deterministic, hence the introduction of OpenCloseTransaction&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Transactions are great %95 of the time, but there's no reason to be afraid of manually opening an closing objects yourself.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 30 Jan 2024 07:36:58 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/can-i-start-transactions-inside-the-application-idle-event/m-p/12528457#M5757</guid>
      <dc:creator>daniel_cadext</dc:creator>
      <dc:date>2024-01-30T07:36:58Z</dc:date>
    </item>
    <item>
      <title>Re: Can I start transactions inside the Application.Idle event without bothering the redo buffer?</title>
      <link>https://forums.autodesk.com/t5/net-forum/can-i-start-transactions-inside-the-application-idle-event/m-p/12528460#M5758</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/4476837"&gt;@ActivistInvestor&lt;/a&gt; Many thanks for these precisions.&lt;/P&gt;</description>
      <pubDate>Tue, 30 Jan 2024 07:39:27 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/can-i-start-transactions-inside-the-application-idle-event/m-p/12528460#M5758</guid>
      <dc:creator>_gile</dc:creator>
      <dc:date>2024-01-30T07:39:27Z</dc:date>
    </item>
    <item>
      <title>Re: Can I start transactions inside the Application.Idle event without bothering the redo buffer?</title>
      <link>https://forums.autodesk.com/t5/net-forum/can-i-start-transactions-inside-the-application-idle-event/m-p/12529055#M5759</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/8575899"&gt;@daniel_cadext&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;&lt;P&gt;it’s actually not rocket science. That’s how it’s done in ARX. I would argue that you should know how DBObjects behave if you want to be more than just a casual CAD programmer, and especially, if you are writing .NET modules professionally.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For those of us that started with .NET in back in 2005, this was the only way. It wasn’t until later that Autodesk realized the garbage collector was non deterministic, hence the introduction of OpenCloseTransaction&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Transactions are great %95 of the time, but there's no reason to be afraid of manually opening an closing objects yourself.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;Autodesk always realized that the GC was non-deterministic, and that code running on the GC's thread had to be thread-safe. The issue was always the complexity of the code needed to deal with direct use of ObjectId.Open(), in cases involving multiple/many DBObjects, and that's the scenario which OpenCloseTransaction was intended to address.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In fact, early-on I had argued that DBObject.Dispose() &lt;EM&gt;should not&lt;/EM&gt; call AcDbObject::close(), but rather, should call cancel() instead (if close() was not previously-called), to make its behavior align with that of Transaction.Dispose().&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But as this thread attests to, knowing how to write code that properly deals with DBObjects accessed using ObjectId.Open() is not something that is all that well-understood.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 30 Jan 2024 13:14:28 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/can-i-start-transactions-inside-the-application-idle-event/m-p/12529055#M5759</guid>
      <dc:creator>ActivistInvestor</dc:creator>
      <dc:date>2024-01-30T13:14:28Z</dc:date>
    </item>
  </channel>
</rss>

