Cyberiafreak

"Fortunate are those who take the first steps.” ― Paulo Coelho

Differences Between MEF and Unity

The main reasons to use Unity (or any other IoC container) are if:

  1. You have dependencies between your objects.
  2. You need to manage the lifetime of an object.
  3. You want to manage dependencies at runtime, such as cache, constructors, and
  4. properties.
  5.  You need to intercept the creation of an object.

The main reasons to use MEF are if:

  1. You need to implement external and reusable extensions in your client application, but you might have different implementations in different hosts.
  2. You need to auto-discover the available extensions at runtime.
  3. You need a more powerful and extensible framework than a normal Dependency Injectionframework, and you want to get rid of the various boot-strapper and initializer objects.
  4. You need to implement extensibility and/or modularity in your component

> Excerpt from book Building Enterprise Applications with Windows Presentation Foundation and the Model View ViewModel Pattern

Advertisements

July 20, 2013 - Posted by | .NET General

No comments yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: