Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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:

  • Desktop only - Open Modularity With Mef QuickStart.bat
  • Desktop only - Open Modularity With Unity QuickStart.bat

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).

  • The application is to be written in WPF (NOT Silverlight).
  • The main application will be extremely thin.
  • The main application will use a Web Service to build the menu of the "apps/modules" a person has access to.
  • The "apps/modules" will be completely contained in other managed libraries.
  • The main application gets views and viewmodels by reflecting into these DLLs.
  • The main application should feed in services for logging, etc. into these "apps/modules".

For example:

A basic user might have the options of:

  • ViewOnly Address record

All items Address related are within Address.dll.

An advanced user might have the options of:

  • New Address record
  • Open Address record (update/delete)
  • Manage users

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. :)

like image 907
myermian Avatar asked Dec 02 '10 21:12

myermian


1 Answers

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, ...)

like image 193
onof Avatar answered Oct 12 '22 05:10

onof