.NET

.NET

Reply
New Member
1 Posts
0 Kudos
Registered: ‎10-20-2006
Post 1 of 2

ObjectModified & Transaction problem

171 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
Post 2 of 2

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
Are you interested in helping shape the future of the Autodesk Community? To participate in this brief usability study, please click here. Your time and input is greatly appreciated!