Sparx Systems Forum

Enterprise Architect => Automation Interface, Add-Ins and Tools => Topic started by: mateiacd on June 11, 2021, 11:23:26 pm

Title: diagram.Update() vs repository.SaveDiagram(diagramID) ?
Post by: mateiacd on June 11, 2021, 11:23:26 pm
Hi

EA.Repository rep = ...; initialized before
EA.Diagram dia = rep.GetCurrentDiagram();

//dia.Update() or rep.SaveDiagram(dia.DiagramID) ?

Is there any difference between the two ?
Both  should save the diagram to the database, hence no difference ?
Title: Re: diagram.Update() vs repository.SaveDiagram(diagramID) ?
Post by: qwerty on June 11, 2021, 11:59:03 pm
I would think so. Not unusual for EA to have duplicate operations doing the same with differend names/parameters. The Save in contrast to update would include manual user changes. Depends on whether the user had a chance to touch the diagram while your script ran.

q.
Title: Re: diagram.Update() vs repository.SaveDiagram(diagramID) ?
Post by: Geert Bellekens on June 12, 2021, 02:10:07 am
- SaveDiagram saves the current unsaved (user) changes to the database.
- Diagram.Update() saves the changes made by your code to the database.

They are definitely not interchangeable

Geert
Title: Re: diagram.Update() vs repository.SaveDiagram(diagramID) ?
Post by: qwerty on June 12, 2021, 08:25:08 am
Geert is right. I ran a short test:
Code: [Select]
d = rep.GetCurrentDiagram()
d.name="test"
rep.savediagram(d.diagramid)
The name was not changed. I wouldn't have been astonished if it had, though.

q.