user210456
user210456

Reputation: 49

Silverlight 5 MEF

We are using MEF v1 with a Silverlight 5 application. We really need support for open generics. It's not clear to me whether this is possible with Silverlight 5.

The dilemma is that I know MEF 1 doesn't support open generics, but MEF 2 does (but MEF 2 is unreleased software still in preview and I don't see any silverlight .sln files when I download it - unlike MEF 1 sources on CodePlex). I know that MEFContrib does support it, but I'm not sure MEFContrib will compile with Silverlight 5.

Has anyone managed to get open generics working with Silverlight 5?

Upvotes: 0

Views: 220

Answers (1)

user210456
user210456

Reputation: 49

To answer my own question: 1) MEF v1 does not support open generics 2) In our project we attempted to use MefContrib to provide an open generics implementation, but we hit a road block with it because we use ExportFactory in our code which does not appear to be covered by any of the work in MefContrib 3) I read a recommendation from Glenn Block (MEF Architect and MefContrib contributor) that using an IoC as well as MEF is actually a reasonable thing to do. Glenn's article. This means you would use MEF to provide third party discoverability but use an IoC within the discovered code.

I personally know that both Castle and Unity have support for open generics. I will therefore recommend to my team that we adopt one of those two IoC's in conjunction with MEF as per Glenn's article.

Upvotes: 1

Related Questions