Hi Evgeny,
We use derived relationships to implement this type of functionality - unfortunately, they don't really work in the shipping CTPs in the DslDesigner - they will however work correctly in the V1 code.
What you'll do is to make a second relationship between Container and FileComponent "ContainerHasFileComponents".
You'll then set the base class of "ContainerhasFileComponents" to be "ContainerHasComponents"
This should give you exactly the behaviour you desire. You'll probably want to set the "IsPropertyGenerator" flag to false on the target roleplayer of the derived relationship as the base relationship will generate you a "Container" property fot the parent relationship.
The one thing you need to be aware of is that it is still possible to create a link of the base type between a Container and a FileComponent as those types are fully type compatible with the both DomainRelationships and the base class is concrete. If you can make Component and FileComponent siblings both derived from an abstract base DomainClass then you can mirror that with an abstract relationship as the aggregate collection and two concrete relationships.
Gareth Jones - Developer - DSL Tools & Software Factories Platform [MSFT] |