Author Topic: Accessing Models through Interop and getting documentation or examples for C#  (Read 334 times)


  • EA Novice
  • *
  • Posts: 9
  • Karma: +0/-0
    • View Profile

I'm starting to develop a C# console application to interact with my .eapx file. I'm at the very beggining and I have been able so far to open the file and get a reference to the model by using repo.Models.GetAt(0). The variable referring to this model, though, is of type object and thus does not have any field or method related to the model itself.

Code: [Select]
var repository = new EA.Repository();
var model = repository.Models.GetAt(0);      // --> Here, model ends up being of "object" type

I have seen in the page that models contain elements such as the Name or the Packages, but if I try to use them, C# compiler complains as both Name and Packages are not properties of object type.

How can I access the data contained in a model?
Is there a place with the complete documentation of the Interop API and/or examples in C#?


Geert Bellekens

  • EA Guru
  • *****
  • Posts: 12048
  • Karma: +469/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
The manual contains a complete reference to the API:

EA uses a lot of generic collections. All of these collections return objects of type "object".  Depending on where you are, you'll have to cast these to the type you need. (e.g. Repository.Models is a collection of EA.Package)

You can find a bunch of examples on my github repo's: