.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

ObjectModified & Transaction problem

1 REPLY 1
Reply
Message 1 of 2
weirdmarriage
375 Views, 1 Reply

ObjectModified & Transaction problem

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
1 REPLY 1
Message 2 of 2
Anonymous
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

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost