Why exactly isn’t MEF a DI/IoC container?

MEF has potential, but as a DI container, it lacks:

  1. Code as Configuration
  2. Auto Registration
  3. XML configuration (not so important to me)
  4. Custom Lifetimes
  5. Interception

Those things are pretty important.

For Lifestyle it lacks:

  1. Per graph
  2. Web Request Context
  3. Thread Context
  4. Session Context
  5. Pooled
  6. Scoped
  7. Custom Reference

References: – Mark Seemann’s book “Dependency Injection in .NET”

Leave a Comment