Book a Demo

Author Topic: .Net Interface Parametrized Generics  (Read 5128 times)

gonzalo.vinas

  • EA Novice
  • *
  • Posts: 11
  • Karma: +0/-0
    • View Profile
.Net Interface Parametrized Generics
« on: November 12, 2008, 12:35:01 am »
Hi there! - I'm trying to make an parametric Interface, like the one in .Net C# Generics interface MyInterface<T> where T : class, but EA latest version doesn't allow me.

I've tried to make first a parametric class, the change its stereotype to <<interface>> and check the abstract check box, but it turned out that Generalization Relationship is enabled for this "pseudo-interface" so I think this isn't the right fix either.

Any ideas ?

Thanks in advance guys.
Gonzalo Viñas

Kaappoo

  • EA Novice
  • *
  • Posts: 1
  • Karma: +0/-0
    • View Profile
Re: .Net Interface Parametrized Generics
« Reply #1 on: November 18, 2008, 04:36:01 am »
I recently reverse-engineered a c# project that contains generic interfaces using the latest version 7.1 They came back as nongeneric interfaces, even including the constraints as a tagged value containing references to the missing type parameters.

If you generate code using such an interface, the code is invalid, because the <type parameters> are missing between the name and the "where" preceding constraints.

I think this may be related to your problem. EA doesn't seem to handle generic interfaces properly. The generic interfaces should behave in the same way as nongeneric, except that they have parameters and therefore need binding to become a specified model element.

By the way, UML reference manual mentions template class, use case, signal, collaboration, package, but I could not find any mention of template interface specifically, only template classifier.


gonzalo.vinas

  • EA Novice
  • *
  • Posts: 11
  • Karma: +0/-0
    • View Profile
Re: .Net Interface Parametrized Generics
« Reply #2 on: November 19, 2008, 05:55:56 am »
Following your last line... yes I know that UML doesn't specify template parameters for interfaces. Maybe someone more involve into EA and UML specs and its core implementation could bring some light to this topic..

BTW VS Class Diagram supports the graphics UML-like interface with template parameters. . .
Gonzalo Viñas