You'll have to use the Mate PropertyInjector
to inject them in an appropriate setter in MainModel
, which handles the collection logic. Something like:
<ns:Injectors target="{MainModel}">
<ns:PropertyInjector source="{SubModelA}" targetKey="updateCollection"/>
<ns:PropertyInjector source="{SubModelB}" targetKey="updateCollection"/>
</ns:Injectors>
Of course, you'll have to add a lot of checks for already added models in the updateCollection
method. With custom [Bindable]
metadata you'll even support binding to the collection in MainModel
. It is a bit ugly (and, actually, a very bad use of dependency injection), but I'm pretty sure you wouldn't be able to instantiate any collection from the EventMap in a reasonable way. The other way is to create your custom Mate action (it's not that hard, see the sources for hints how to do it). You may also consider simplifying your design.