|
You’re right about the custom attribute in cases that the metadata does not allow multi,
otherwise metadata cannot inherit the ExportAttribute.
This was the case that I was looking for, when I tried to use the InheritedExport solution.
The motivation for that solution was that I want my consumer to have as little space for errors as possible, and to put only the decoration they must.
For the newer MEF versions you may consider to enable property on the metadata attribute definition which will explicitly define the type that it related to,
Something like [MeatdataAtribute (typeof(IFoo))]
This way MEF won’t have to deal with inheritance of metadata and the consumer can add metadata for InheritanceExport,
As for the InheritanceExport scenario, the feedback that I get from the real world is that people like to inherit the interface without any additional decoration, so the inheritance will become their export.
|