I have the next code:
public void Update(IDgnECInstance instance, string propertyName, string value) { instance.SetAsString(propertyName, value); instance.WriteChanges(); }
Ivan Petrov said:But can we manipulate transactions? This seems to be a more useful approach...
There is transaction manager available, but:
I recommend to study C++ documentation, important details are described there.
Ivan Petrov said:This seems to be a more useful approach...
Why? I do not think so.
DgnTool encapsulates complex logic into simpler API so as Jon wrote, when element is modified, DgnElementSetTool ensures everything is done in the right way (not only transaction itself, but also proper name to be displayed in GUI etc).
Ivan Petrov said:I have the next code:
It does not provide too much information about context, but depending whether you change EC data only or also the element itself, to use scheduling system is necessary.
With regards,
Jan
Bentley Accredited Developer: iTwin Platform - AssociateLabyrinth Technology | dev.notes() | cad.point
Thank you very much for your answer.
But can we manipulate transactions? This seems to be a more useful approach...
Ivan Petrov said:How can I enable users to reverse actions performed in my custom form using the "undo-redo" function (the arrows that allow you to revert changes)?
MicroStation automatically creates a transaction for primitive commands. The undo/redo logic causes a transaction to be rolled back/forward.
If your code that modifes an Item instance is embedded in a primitive command then the transaction logic is applied automatically. Create your own command class, inheriting from DgnElementSetTool.
DgnElementSetTool
Regards, Jon Summers LA Solutions