Book a Demo

Author Topic: Couple of questions regards creating a new "Connector"  (Read 9515 times)

ejafman

  • EA User
  • **
  • Posts: 30
  • Karma: +0/-0
    • View Profile
Couple of questions regards creating a new "Connector"
« on: April 16, 2026, 10:58:50 pm »
Hi all,

I am trying to automate importing relationships between classes.

Looking at the code snippet, the example shows the connector object being added to the source class:

Code: [Select]
Set con = source.Connectors.AddNew("test link 2", "Association")[

Just curious whether that is absolutely necessary to add it first to the element, or can I just create a "new" connector, and then update the client and supplier ends after.
In other words, is the connector actually owned by one of the ends, or is the example just showing one way? When I debug the actual source and target elements, I see the connector associated to both, in their respective "Connectors" property.

TIA...Eric

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Couple of questions regards creating a new "Connector"
« Reply #1 on: April 17, 2026, 12:42:20 am »
It's quite simple. You can only create new EA objects by calling the AddNew method on the EA.Collection of their parent.

For connectors, you add them to the source element, and then update the supplierID. (the ClientID is automatically filled in by EA)

In theory, I guess you could add the connector to any EA.Element.Connectors collection and then update both ClientID as SupplierID I guess.
Not sure why you would want to do that though.

A connector is not "owned" by the source or target element. It will indeed show up in both Connectors collection.

Geert

ejafman

  • EA User
  • **
  • Posts: 30
  • Karma: +0/-0
    • View Profile
Re: Couple of questions regards creating a new "Connector"
« Reply #2 on: April 17, 2026, 01:17:37 am »
Thanks...I was afraid of that ;)

Will work through it...also need to be able to update source and target classes on a given connector, without changing the underlying GUID. Playing around, and I was able to change the target to another class. I will continue to play, to see if I can change the source to another class as well.

E