Aug 1, 2011 at 9:50 AM
Edited Aug 1, 2011 at 9:51 AM
I'd like to produce the Cartesian product between exports, illustrated here by this example:
class InfoObjectProcessor : IProcessor
public InfoObjectProcessor([Import] IInfoObject info);
Engine([ImportMany] IEnumerable<IProcessor> processors);
When I query my catalog for the Engine part, I'd like all of the IInfoObjects in the container to be wrapped by the InfoObjectProcessor and create many IProcessors that can satisfy the Engine export. Here, this makes sense because there's an importing
constructor that can create many IProcessors given an IInfoObject.
But this doesn't work and instead, if I have anything but a single IInfoObject export I get the cardinality issue and no processors.
This is the first time I find myself having to do this and maybe it's the result of doing something malicious to begin with. I'd like to know how this problem is best solved, I haven't written custom ExportProviders but it seems like I should be
doing that, creating an export provider that would provide an IProcessor export for each IInfoObject export. I guess the easiest way is just to create a companion processor export for each info export but that's a lot of labor that I'd like to avoid, if reasonably