<?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 lock document always? in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/lock-document-always/m-p/3407097#M56341</link>
    <description>&lt;P&gt;If I am writing a library of tools to draw things, that library may be used from modal or modeless forms.&lt;/P&gt;&lt;P&gt;I would not want to put the document locking in the library, or would I?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Should I just be safe and always lock the document before drawing something?&lt;/P&gt;&lt;P&gt;Should I add a "running from modeless" param to every function to allow locking?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Its tricky because if I don't put in library, the tools that call the library must know when to lock.&lt;/P&gt;&lt;P&gt;Its obvious sometimes, but not always. Any advice on structuring this?&lt;/P&gt;</description>
    <pubDate>Tue, 10 Apr 2012 17:18:37 GMT</pubDate>
    <dc:creator>JamesMaeding</dc:creator>
    <dc:date>2012-04-10T17:18:37Z</dc:date>
    <item>
      <title>lock document always?</title>
      <link>https://forums.autodesk.com/t5/net-forum/lock-document-always/m-p/3407097#M56341</link>
      <description>&lt;P&gt;If I am writing a library of tools to draw things, that library may be used from modal or modeless forms.&lt;/P&gt;&lt;P&gt;I would not want to put the document locking in the library, or would I?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Should I just be safe and always lock the document before drawing something?&lt;/P&gt;&lt;P&gt;Should I add a "running from modeless" param to every function to allow locking?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Its tricky because if I don't put in library, the tools that call the library must know when to lock.&lt;/P&gt;&lt;P&gt;Its obvious sometimes, but not always. Any advice on structuring this?&lt;/P&gt;</description>
      <pubDate>Tue, 10 Apr 2012 17:18:37 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/lock-document-always/m-p/3407097#M56341</guid>
      <dc:creator>JamesMaeding</dc:creator>
      <dc:date>2012-04-10T17:18:37Z</dc:date>
    </item>
    <item>
      <title>Re: lock document always?</title>
      <link>https://forums.autodesk.com/t5/net-forum/lock-document-always/m-p/3407113#M56342</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Yes, you need locking if you modify items within a loaded document.&lt;/P&gt;&lt;P&gt;No, you don't need locking if the command itself has the attribtue for locking/exclusive access.&lt;/P&gt;&lt;P&gt;No, you don't need locking if you are just reading some objects from your loaded document&lt;/P&gt;&lt;P&gt;No, you don't need locking if you modify some objects in a database (not loaded) in editor.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And the last point is the decission (at least for me) to not do a lock in every lib-function as in most function calls I transfer an objectid or an entity or a database as parameter, but never the document .... as I want my lib also working on just db-objects (and not loaded as documents).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I do the locking (and some init-sequence for a global error-handler/-messaging system) at the very early start of a function and the .dispose of it at the end.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;my 2c&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;- alfred -&lt;/P&gt;</description>
      <pubDate>Tue, 10 Apr 2012 17:26:50 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/lock-document-always/m-p/3407113#M56342</guid>
      <dc:creator>Alfred.NESWADBA</dc:creator>
      <dc:date>2012-04-10T17:26:50Z</dc:date>
    </item>
    <item>
      <title>Re: lock document always?</title>
      <link>https://forums.autodesk.com/t5/net-forum/lock-document-always/m-p/3407121#M56343</link>
      <description>&lt;P&gt;thx for reply.&lt;/P&gt;&lt;P&gt;It seems odd to me, so far,&amp;nbsp;that we must deal with locking.&lt;/P&gt;&lt;P&gt;I would expect that when we attempt to modify the database, it tries to lock it automatically.&lt;/P&gt;&lt;P&gt;I think what you mentioned about running on a database not open in the editor is the key.&lt;/P&gt;&lt;P&gt;You need a way to stop the regular interaction&amp;nbsp;of the UI&amp;nbsp;with a loaded drawing to draw stuff.&lt;/P&gt;&lt;P&gt;Seems like that could be handled in the background too though.&lt;/P&gt;&lt;P&gt;I have not seen enough examples that take advantage of not locking the document to see why its left up to us.&lt;/P&gt;&lt;P&gt;Any obvious reasons that come to mind?&lt;/P&gt;&lt;P&gt;thx&lt;/P&gt;</description>
      <pubDate>Tue, 10 Apr 2012 17:34:40 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/lock-document-always/m-p/3407121#M56343</guid>
      <dc:creator>JamesMaeding</dc:creator>
      <dc:date>2012-04-10T17:34:40Z</dc:date>
    </item>
  </channel>
</rss>

