Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 679533
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T01:16:13+00:00 2026-05-14T01:16:13+00:00

i am in big dilema.. I am working on highly modular web app in

  • 0

i am in big dilema..
I am working on highly modular web app in ASP.NET MVC 2 (in fact, core will be super lightweight, all work on modules/plugins). I found MEF pretty useful for modules discovery, but i dont want to us it as IoC container. There is pretty good chance that I will need advanced features of “true” IoC container, so I would like to use Unity.

And here is the problem : how to allow modules to configure container (programatically) = register their own types (mvc controllers, custom implementations of services…) at application start without making hard dependency on Unity in all modules ?
I know about Common Service Locator project, and it seems pretty good, but this interface co container only allows resolving types, not registering them (afaik).

I really hope you can understand my point, I know my english is terrible (I am from non english speaking country 🙂
Thanks a lot !

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T01:16:13+00:00Added an answer on May 14, 2026 at 1:16 am

    I can certainly sympathize with not wanting to use MEF as a DI Container, but I think you should still consider whether that might not be applicable for your add-ins.

    You already require your add-ins to use MEF, so they will all have a hard dependency on it. While I personally don’t like the hard-coded, attribute-based approach used by MEF, it sounds like you are asking how each add-in can register itself with the DI Container. That also sounds like hard-coding to me, so you might as well just use MEF all the way in.

    Applying MEF attributes is component registration.

    If you really don’t want to use MEF you only have a few other options (none of them particularly more attractive):

    • Require all add-ins to also take a hard dependency on Unity. I completely understand why you don’t want to do this, but I’m just including this option for the sake of completeness
    • Require all add-ins to also take a hard dependency on Common Service Locator. In my view, this only shifts the problem slightly.
    • Define your own add-in registration interface that all add-ins must implement. You can then write your own implementation that uses Unity, so that all add-ins register themselves against this interface, but then you would more or less just be duplicating the features of MEF.
    • Write all add-ins in a DI-friendly, but container-agnostic style. This leaves the problem with configuring the DI Container, and you will then have to resort to XML configuration for that. This is a very brittle approach and can quickly lead to maintainance hell, so once again I’m just including this option for the sake of completeness.

    Using MEF for add-ins doesn’t preclude you from using Unity in your core application, but I do understand that it’s very lightweight, so that may not make a lot of sense.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a big .net mvc 2 project where we are using MvcContrib Portable
i have a big web application running in perl CGI. It's running ok, it's
Context: I'm in the design phase of what I'm hoping will be a big
Big problem. I'm not sure what it was that I did, but it seems
I am reviewing a big java application to see if there are any performance
I have a big string (let's call it a CSV file, though it isn't
It's big problem to convert mod_rewrite rules to lighttpd format
What is Big O notation? Do you use it? I missed this university class
Server virtualization is a big thing these days, so I'm tasked at work to
I'm a big fan of the Jadclipse plugin and I'd really like to upgrade

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.