autocad - Attributes of a C# Property Changing after Getter call -


the code below property 1 of classes

public subdmesh placeholder {         {         document doc = autodesk.autocad.applicationservices.application.documentmanager.mdiactivedocument;         database db = doc.database;         transaction tr = db.transactionmanager.starttransaction();         documentlock doclock = doc.lockdocument();          using (tr)         using (doclock)         {             return tr.getobject(idofplaceholder, openmode.forwrite) subdmesh;         }     } } 

subdmesh, class autocad's api, has property called iswriteenabled want true can make changes object. explicitly specify openmode.forwrite in getobject. however, when go make changes in next code segment

placeholder.visible = false; 

it blows up. looking @ variable after getter called reveals iswriteenabled changed true false right after object returned. how can keep writing enabled?

it seems transaction , documentlock objects responsible managing writes subdmesh. both objects disposed @ end of getter, write transaction rolled immediately.

try doing operations on subdmesh within using (tr) using (doclock) (or wrap tr , doclock in disposable class keep them alive longer).


Comments

Popular posts from this blog

java - WARN : org.springframework.web.servlet.PageNotFound - No mapping found for HTTP request with URI [/board/] in DispatcherServlet with name 'appServlet' -

html - Outlook 2010 Anchor (url/address/link) -

android - How to create dynamically Fragment pager adapter -