.NET

Reply
New Member
weirdmarriage
Posts: 1
Registered: ‎10-20-2006
Message 1 of 2 (169 Views)

ObjectModified & Transaction problem

169 Views, 1 Replies
10-20-2006 12:46 AM
When I use ObjectModified event to do something and following code causes error:
private void WorkingDatabase_ObjectModified(object sender, ObjectEventArgs e)
{
try
{
using (Transaction trans = HostApplicationServices.WorkingDatabase.TransactionManager.StartTransaction())
{
/*do something*/
trans.commit();
}
}
catch (Exception ex)
{
/*do something*/
}
}

the code crash at StartTransaction(), then I cannot fix it.
if I use TopTransaction replace the StartTransaction(), then the exception is eInprocesscommiting.

by the way, whether exist somewhere expose the transactionEnded event in Autocad managed class.


thanks for your help.

gyn
*Tony Tanzillo
Message 2 of 2 (169 Views)

Re: ObjectModified & Transaction problem

10-20-2006 07:07 PM in reply to: weirdmarriage
I don't think you can start a transaction from
this event. You can use ObjectId.Open() to open
objects, and ignore the warning.

--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD 2004/2005/2006/2007
http://www.acadxtabs.com

wrote in message news:5368594@discussion.autodesk.com...
When I use ObjectModified event to do something and following code causes error:
private void WorkingDatabase_ObjectModified(object sender, ObjectEventArgs e)
{
try
{
using (Transaction trans = HostApplicationServices.WorkingDatabase.TransactionManager.StartTransaction())
{
/*do something*/
trans.commit();
}
}
catch (Exception ex)
{
/*do something*/
}
}

the code crash at StartTransaction(), then I cannot fix it.
if I use TopTransaction replace the StartTransaction(), then the exception is eInprocesscommiting.

by the way, whether exist somewhere expose the transactionEnded event in Autocad managed class.


thanks for your help.

gyn
Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Announcements
Do you have 60 seconds to spare? The Autodesk Community Team is revamping our site ranking system and we want your feedback! Please click here to launch the 5 question survey. As always your input is greatly appreciated.