Book a Demo

Author Topic: v16 - Update diagram fails even after reloading the diagram in c#  (Read 6543 times)

ea0921

  • EA User
  • **
  • Posts: 104
  • Karma: +0/-1
    • View Profile
If another user has made any update to the diagram, then before updating the diagram user needs to reload the diagram.
This is displayed on the EA application as well.

However, even after reloading the diagram using Repository.ReloadDiagram (currentDiagram.DiagramID);, update diagram fails with following error "No such diagram found having diagram GUID: ".
« Last Edit: October 21, 2022, 04:34:13 am by ea0921 »

ea0921

  • EA User
  • **
  • Posts: 104
  • Karma: +0/-1
    • View Profile
Re: v16 - Update diagram fails even after reloading the diagram in c#
« Reply #1 on: October 26, 2022, 02:05:18 am »
Hi, can I get any help for this. If needed I can elaborate more as well.
Also some of the things I observed that after a diagram has been created/updated by any user from EA application interface, reload is not needed for another user before using diagram.update().
However, if any entity is updated using diagram.update(), then the consequent update from another user does not work even after using  Repository.ReloadDiagram().

Is there any other operation being processed in backend after update from EA application interface which is processed after diagram.update()?

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: v16 - Update diagram fails even after reloading the diagram in c#
« Reply #2 on: October 26, 2022, 08:23:23 am »
That's intended behavior. Element/feature updates are directly reflected in the DB. In contrast diagram changes are only stored at an diagram.update.

I'd guess the reason for that iss performance. But however it has been reasoned once, now it will not change for a long, long time.

q.

ea0921

  • EA User
  • **
  • Posts: 104
  • Karma: +0/-1
    • View Profile
Re: v16 - Update diagram fails even after reloading the diagram in c#
« Reply #3 on: October 27, 2022, 06:11:07 pm »
This code snippet worked previously with version 15 of EA, after upgrading to version 16 it is giving error even after reloading the object.
Here is the code snippet that I am using, it gives error on second diagramupdate() i.e. after connecting to user2 and trying to update diagram from his connection with following error "No such diagram found having diagram GUID: "
{
//connect to user1
   EAConnection connection = new EAConnection();
   connection.EARepository = new Repository();
   connection.EARepository.SuppressSecurityDialog = true;
   connection.EARepository.SuppressEADialogs = true;
   bool isOpened = connection.EARepository.OpenFile2("path", "username1", "password");
   
//update diagram with user1
   ReloadDiagram(diagram);  //reload diagram object
   //update attribute values
   diagram.name = "xyz";
    diagram.Update();   
   //perform checkin for package

//connect to user2
   EAConnection connection = new EAConnection();
   connection.EARepository = new Repository();
   connection.EARepository.SuppressSecurityDialog = true;
   connection.EARepository.SuppressEADialogs = true;
   bool isOpened = connection.EARepository.OpenFile2("path", "username2", "password");
   
//update diagram with user1
   ReloadDiagram(diagram);  //reload diagram object
   //update attribute values
   diagram.name = "abc";
    diagram.Update();   
   //perform checkin for package

}

It is expected behaviour to use diagram.update() however, even after reloading the object I am unable to update the diagram.
However, from EA application interface after reloading the object I am able to update the entity. Is there any other step performed after create/ update missed in this code snippet that is performed from EA application after updating a diagram.

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: v16 - Update diagram fails even after reloading the diagram in c#
« Reply #4 on: October 27, 2022, 07:36:30 pm »
It feels like I'm missing multiple pieces of the puzzle.

What does ReloadDiagram() do, and where does the diagram object come from?

And where exactly is it giving which error?

Geert

ea0921

  • EA User
  • **
  • Posts: 104
  • Karma: +0/-1
    • View Profile
Re: v16 - Update diagram fails even after reloading the diagram in c#
« Reply #5 on: October 27, 2022, 07:52:42 pm »
ReloadDiagram() is the interfaced method to refetch the diagram from EA. This method is provided by EA repository class, it takes diagram id as input repository.ReloadDiagram(diagram.DiagramID);.

Diagram object is fetched on the diagram id.

It is giving error on this update call:
diagram.name = "abc";
    diagram.Update(); 
When another user is trying to update diagram even after reloading the diagram.

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: v16 - Update diagram fails even after reloading the diagram in c#
« Reply #6 on: October 27, 2022, 08:01:22 pm »
OK, but you are using
Code: [Select]
ReloadDiagram(diagram);, which is not the same as Repository.ReloadDiagram(DiagramID)

To understand what is going on, and maybe help you, we really need the full picture, not simply snippets left and right without context.

Why exactly are you calling the ReloadDiagram method? This method is only useful to update the visible part of the diagram in the user interface, so typically you would call that only after changing the contents of the diagram.
It does not affect the diagram object you are using in any way.

Geert

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: v16 - Update diagram fails even after reloading the diagram in c#
« Reply #7 on: October 27, 2022, 08:01:39 pm »
Black box debugging does not work. Unless you show what that obscure ReloadDiagram does you are on your own here.

q.

P.S. I was a few seconds late after Geert...

ea0921

  • EA User
  • **
  • Posts: 104
  • Karma: +0/-1
    • View Profile
Re: v16 - Update diagram fails even after reloading the diagram in c#
« Reply #8 on: October 27, 2022, 09:11:43 pm »
Yes, my bad. Missed adding few details.
{
//connect to user1
    EAConnection connection = new EAConnection();
    connection.EARepository = new Repository();
    connection.EARepository.SuppressSecurityDialog = true;
    connection.EARepository.SuppressEADialogs = true;
    bool isOpened = connection.EARepository.OpenFile2("path", "username1", "password");
   
//update diagram with user1
    diagram = repository.GetDiagramByGuid(guid);
    repository.ReloadDiagram(diagram.DiagramID);  //reload diagram object
    //update attribute values
    diagram.name = "xyz";
    diagram.Update();   
    //perform checkin for package

//connect to user2
    EAConnection connection = new EAConnection();
    connection.EARepository = new Repository();
    connection.EARepository.SuppressSecurityDialog = true;
    connection.EARepository.SuppressEADialogs = true;
    bool isOpened = connection.EARepository.OpenFile2("path", "username2", "password");
   
//update diagram with user1
    diagram = repository.GetDiagramByGuid(guid);
    repository.ReloadDiagram(diagram.DiagramID);  //reload diagram object
    //update attribute values
    diagram.name = "abc";
    diagram.Update();   
    //perform checkin for package
}

ea0921

  • EA User
  • **
  • Posts: 104
  • Karma: +0/-1
    • View Profile
Re: v16 - Update diagram fails even after reloading the diagram in c#
« Reply #9 on: October 27, 2022, 09:21:05 pm »
As for reload diagram and why I am using that, on EA UI as well if user1 has made changes then to update the same diagram user2 has to reload the diagram before making updates to it.
And the following has been mentioned pertaining to reload and auto reload in release notes of v16.

An Auto Refresh facility has been added for diagrams, providing improved support for multiple people giving input on the same diagram and allowing users to monitor changes on a specific diagram.
The Auto Refresh facilities are now available from the Layout ribbon, 'Auto Refresh' panel.
A new Auto Reload facility has been provided to reload any diagrams that you have open that have been updated and saved by another user within the last 60 seconds.
Fixed Regression with Automation Repository.ReloadDiagram

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: v16 - Update diagram fails even after reloading the diagram in c#
« Reply #10 on: October 27, 2022, 10:05:11 pm »
Code: [Select]
   diagram = repository.GetDiagramByGuid(guid);
    repository.ReloadDiagram(diagram.DiagramID);  //reload diagram object
 
seems strange. You do not open it which is probably mandatory before issuing a reload.

q.


ea0921

  • EA User
  • **
  • Posts: 104
  • Karma: +0/-1
    • View Profile
Re: v16 - Update diagram fails even after reloading the diagram in c#
« Reply #12 on: October 27, 2022, 11:45:49 pm »
We are creating diagram with user1 and then updating with the same user, then after that we are trying to update with user2. We are using 32 bit EA of 1605 build.

Also the permission for both users is same, user1 may update first and user2 updates after that, this gives an error as well as vice versa case.

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: v16 - Update diagram fails even after reloading the diagram in c#
« Reply #13 on: October 28, 2022, 01:03:21 am »
In your code you are not creating a diagram with user1.

If you don't post the actual code that produces the problem, it's pretty hard to help you. All we can do is guess.

Geert