Book a Demo

Author Topic: Problem with adding Links(Connectors)  (Read 5363 times)

Ceronimo

  • EA User
  • **
  • Posts: 45
  • Karma: +0/-0
    • View Profile
Problem with adding Links(Connectors)
« on: April 27, 2016, 09:42:22 pm »
hi,

i'm copying Elements via drag and drop from my library (which i load from a xmi file) to my current Project.

Everything works fine and a Link is created, i can see it in the properties of Library Element and CopiedElement.

But when i try to get These Links again to Change them with my code, the Debugger says always that

newElement.Connectors.Count is 0 but when i look in ea at the properties of These Elements they have got a link.

Can someon tell me why i can create links but cannot read them ?

My aim is to create links form the copied element to his library Element.

EA.Connector aConnector;

            aConnector = newElement.Connectors.AddNew(name,type);
           
            aConnector.ClientID = newElement.ElementID;
            aConnector.SupplierID = aElement.ElementID;
            aConnector.Stereotype = "IsLibInstance";
            aConnector.Update();
            MessageBox.Show(newElement.Connectors.Count);

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Problem with adding Links(Connectors)
« Reply #1 on: April 27, 2016, 10:16:15 pm »
After creating a connector the .Connectors collection is not updated yet.
If you want to update the collection then you have to use Refresh() (usually that works)

Geert

Ceronimo

  • EA User
  • **
  • Posts: 45
  • Karma: +0/-0
    • View Profile
Re: Problem with adding Links(Connectors)
« Reply #2 on: April 27, 2016, 10:31:43 pm »
Nooby mistake !
today is not my day :D

thanks a lot geert