Book a Demo

Author Topic: Is Enterprise Architect Object Model thread-safe.  (Read 100 times)

ea0921

  • EA User
  • **
  • Posts: 106
  • Karma: +0/-1
    • View Profile
Is Enterprise Architect Object Model thread-safe.
« on: Today at 12:37:52 am »
I have created an external script in .NET that connects to the Enterprise Architect application through its Object Model. The script programmatically accesses, modifies, creates, and deletes entities and their associated data in Enterprise Architect.

The script performs the following operations:

  • It creates an EA Repository object using new Repository() and then opens an EA project through that Repository object.
  • The same EA Repository object is accessed concurrently by multiple threads in the external script.
  • Multiple API calls are made concurrently through the same EA Repository connection. Some examples are listed below:

    • Fetching elements, including use case-type entities, from a package. A sample query is shown below:
      select TOP 400 t_object.Name, t_object.ModifiedDate, t_object.CreatedDate, t_object.Package_ID, t_object.object_id, t_object.ea_guid AS CLASSGUID from t_object where object_type='Class' and t_object.Package_ID in (517,745) and ((t_object.ModifiedDate > '2026-11-13 01:48:31 PM' AND t_object.ModifiedDate <= '2026-11-13 01:48:31 PM') OR (t_object.ModifiedDate = '2026-11-13 01:48:31 PM' AND t_object.ea_guid > '<package_guid>')) order by t_object.ModifiedDate asc, t_object.ea_guid asc
    • Creating diagrams, requirements, and a few other entity types in the same package referenced above.
    • Deleting entities such as elements, diagrams, and packages.
    • Refreshing the EA Repository by calling EARepository.Models.Refresh().
    • SQL queries made to the EA repository is made via: repository.SQLQuery(query);
    • And other COM calls.
I would like confirmation on the following:
  • Is the Enterprise Architect Object Model thread-safe?
  • Are the underlying COM calls thread-safe when the same EA Repository object is accessed concurrently by multiple threads?
  • Can multiple threads safely perform read, create, modify, delete, and refresh operations simultaneously through the same EA Repository instance?
  • If the Enterprise Architect Object Model is not thread-safe, what thread-management approach does Enterprise Architect recommend?
Additional context:
  • The threads created by the external script are not configured as STA threads.
  • Multiple requests can invoke the external script concurrently.
  • Within each invocation, multiple threads may simultaneously make calls to Enterprise Architect.
  • These concurrent calls may use the same EA Repository object.
  • .Net framework I am using: 4.7.2
  • Application type: WCF SOAP application
  • EA Repository type on which operations are performed: All EA repository type
Could you also provide links to the official Enterprise Architect documentation that describe the following:
  • The behavior of the Enterprise Architect Object Model in a multithreaded environment.
  • Any threading or COM apartment requirements, including STA or MTA requirements.
  • Whether an EA Repository object can be shared across multiple threads.
  • The recommended approach for managing concurrent access to Enterprise Architect.
  • Whether separate EA Repository instances should be created for separate threads or concurrent requests.

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8124
  • Karma: +120/-20
    • View Profile
Re: Is Enterprise Architect Object Model thread-safe.
« Reply #1 on: Today at 08:25:52 am »
The key point in your post is this one:
  • Application type: WCF SOAP application
https://sparxsystems.com/products/ea/17.2/eula.html
Quote
  • Server based installations that provide concurrent end users with content or functionality derived from a running remote instance of Enterprise Architect over a network is not officially supported by Sparx Systems. (This is due to technical limitations in the Enterprise Architect product, specifically its construction as a single user application interacting with the desktop UI). If you wish to deploy or use Enterprise Architect in this manner, as a minimum you MUST adhere to the requirements detailed below and further elaborated here: https://sparxsystems.com/products/ea/server-legal.html and accept the risks and responsibilities attendant on that;
    • Every end user MUST have a genuine Enterprise Architect license of the correct edition;
    • The end user must have a licence under their own name, even if that licence is obtained by that user's organization on that person's behalf;
    • Sub-licensing Enterprise Architect by 3rd Parties to end users is not permitted;
    • A Fixed license per end user is required without exception. Licenses cannot be dynamically allocated or transferred between end users;
    • Unlimited Read-Only and/or Unlimited Read/Write access to a server based instance of Enterprise Architect is expressly forbidden as unlicensed end users may be illegally authorized (with or without their knowledge) to use the Enterprise Architect instance on the server.
    • A server based instance must NOT be used to create a derivative work, adapt Enterprise Architect for another platform, virtualize separate functionality or otherwise contravene the rights and entitlements granted to Sparx Systems under copyright law and not expressly granted to the end user in the Enterprise Architect EULA.
    • You acknowledge the risks and limitations inherent in using Enterprise Architect in a manner that is not supported nor recommended and waive all rights and warranties pertinent to this use.

With that in mind...
  • Is the Enterprise Architect Object Model thread-safe?
  • Are the underlying COM calls thread-safe when the same EA Repository object is accessed concurrently by multiple threads?
  • Can multiple threads safely perform read, create, modify, delete, and refresh operations simultaneously through the same EA Repository instance?
  • If the Enterprise Architect Object Model is not thread-safe, what thread-management approach does Enterprise Architect recommend?
Could you also provide links to the official Enterprise Architect documentation that describe the following:
No, no, no, no recommendations and no documentation.

ea0921

  • EA User
  • **
  • Posts: 106
  • Karma: +0/-1
    • View Profile
Re: Is Enterprise Architect Object Model thread-safe.
« Reply #2 on: Today at 04:04:36 pm »
Hello Eve,

Can you please let us know the COM component which is exposed by the Enterprise architecture application is an STA COM component or an MTA COM component. This information will help us to better understand the Enterprise architecture Object Model API.

Thanks.

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13552
  • Karma: +579/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Is Enterprise Architect Object Model thread-safe.
« Reply #3 on: Today at 07:26:30 pm »
I have some experience using EA in a multithreaded add-in.
My EA Navigator add-in will get the details of an object in a background thread to avoid blocking the user.

In most cases this seems to work, but once in a while it runs into weird threading related errors.

For my use case that wasn't really a big deal, and I can simply catch and ignore those errors.

Geert