Author Topic: Extending the Repository class in the DLL  (Read 1871 times)

MatthiasVDE

  • EA User
  • **
  • Posts: 196
  • Karma: +1/-0
    • View Profile
Extending the Repository class in the DLL
« on: July 06, 2022, 04:30:43 pm »
I'm extending the Repository class with some extra functions to make my development easier.

Code: [Select]
public class Repository : EA.RepositoryClass
{

}

When I add some new functions it works perfect. But now I want to add a new 'Collection' type to create and add new objects to the repository.

Code: [Select]
// Existing function
Repository.Stereotypes.AddNew

// New function
Repository.CustomObjects.AddNew

It's a long time ago that I worked with C#, so I hope that someone can give me a hint into the right direction.

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13404
  • Karma: +567/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Extending the Repository class in the DLL
« Reply #1 on: July 06, 2022, 04:54:09 pm »
Matthias,

Maybe you should what the goal is you are trying to achieve.

I've done a lot of add-in development, but I really can't follow what you are trying to do. Not even why you are creating a subclass of EA's repository class.
How does that work? EA surely only creates and passes it's own repository class, and not your subclass doesn't it?

My approach was to use composition rather then inheritance in this case (as you might remember) I think that is more suited in this case.

Geert

MatthiasVDE

  • EA User
  • **
  • Posts: 196
  • Karma: +1/-0
    • View Profile
Re: Extending the Repository class in the DLL
« Reply #2 on: July 06, 2022, 04:57:48 pm »
Hi Geert,

My 'Repository' class inherits from the EA.Repository class in the Interop DLL.
And I want to extend my class with some extra functions to add for example easily new Tagged Value Types.

EDIT: Indeed, I forgot... If I remember your concept of wrappers was based on a new class that contains the class from the EA.dll?
« Last Edit: July 06, 2022, 05:04:16 pm by MatthiasVDE »