I am trying to use both MEF and Windsor together in the same project,
which has a core with extension points which plugins can take
advantage of. I am basically using Windsor to inject known
dependencies, and want to use MEF to export/import variable numbers of
things that implement whatever is needed to take advantage of an
extension point. The problem is that some MEF exports have
dependencies themselves, which I would like Windsor to inject.

I started with the Castle.Mef code from
https://www.assembla.com/code/kkozmic/subversion/nodes/Garage/Castle.Mef?rev=56
to try and get this working. However, one thing I need to do is Import
(Resolve) a single IEnumerable<T> based on multiple Exports of type T
(multiple per plugin, or from multiple plugins, etc), which is not
supported by that code. I also have cases where there are multiple
Exports of type T, but with different contract names, and I need to be
able to get a single IEnumerable<T> based on contract name.

I modified the Castle.Mef code to handle #2 by specifically looking
for Service type of IEnumerable<>, and if MEF has no Exports for the
type itself, I get the generic argument of the IEnumerable<> and query
MEF for Exports of that type. In MefLifestyle, I then call
GetExportedValues (instead of singular GetExportedValue) and return a
new List<> with those values. But, the dependencies on the items in
that list are not injected (I assume because Windsor sees the return
value from MefLifestyle.Resolve as List<> which itself does not have
any dependencies it can inject).

Is there any way I can get this to work? Am I just going the wrong
direction to get MEF and Windsor to work together (keeping in mind #2
above)?

Any help or insight is much appreciated.

-- 
You received this message because you are subscribed to the Google Groups 
"Castle Project Users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/castle-project-users?hl=en.

Reply via email to