wpfmvvmunity-containermefprism-4

Prism v4: Unity or MEF?


I downloaded Prism v4 and ran the installer. I went into the directory and ran the two following batch files:

When I compile these applications, I don't see any real difference. I've searched for MEF vs Unity and I've found some pros/cons, but nothing that specifically states whether one is "better" (and I know that is subjective) with use in Prism. I guess perhaps if I list my requirements someone can point me to the correct technologies to use (even if it's not Prism 4).

For example:

A basic user might have the options of:

All items Address related are within Address.dll.

An advanced user might have the options of:

All items Address related are within Address.dll.
All items Manage related are within Admin.dll.

The app should not actually reference either of these DLLs, I plan to reflect into them so that if there are 100 different modules and a user only has access to 2 of them, only 2 of them are downloaded and used. Whereas a user that has access to 10 of them gets those 10.

I've already solved the downloading DLL via WebService. :)


Solution

  • None is "better": they are different things.

    IMO your choice should be driven only by your requirements. Based on the requirements you posted here I would suggest you to use MEF, because you have modules contained in DLLs and the main app is unaware of modules to load. Those tasks are the reason that why MEF exists.

    Anyway you could use them both: MEF for modularity and Unity to take advantages of dependency injection (testability, reusability, ...)