与MSSQL事务类似
start
[Transaction(TransactionMode.Automatic)]
[Regeneration(RegenerationOption.Automatic)]
public class theTransaction : IExternalCommand
{
public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
{
UIApplication uiApp = commandData.Application;
Document doc = uiApp.ActiveUIDocument.Document;
Transaction ts = new Transaction(doc, "事务");
ts.Start();
//添加代码,若有失败则回滚
ts.Commit();
return Result.Succeeded;
}
}
end