Good IOC Frameworks to use with mvc? 

حمایت از ما | مشهدهاست

Good IOC Frameworks to use with mvc?

حمایت از ما | مشهدهاست

حمایت از ما | مشهدهاست حمایت از ما | مشهدهاست

حمایت از ما | مشهدهاست

Good IOC Frameworks to use with mvc?


6 years ago


1959 times


4 years ago

I am wondering what good simple IoC frameworks are there for mvc? that have good documentation and are just easy to get up and going.


2010-05-06 04:23:56Z


I've used Autofac and have been very happy with it.

Configuration is mostly done in code so you get compile time checking for your mappings as opposed to programming in XML and hoping for the best. It also supports XML overrides though so if you absolutely need to leave something to be configured at run/deploy time it's possible.

The Contrib (not sure what to call it?) portion provides integrations for NHibernate, Moq, etc. The creator of the project worked at Microsoft for a year on the MEF team so there's some MEF integration as well.

The documentation section of the site is pretty good (though if you don't find what you need there, it probably doesn't exist...yet). On the up side the author is on SO so if you have questions and tag the appropriately you could probably get quality answers.

You might also be interested in these two blog posts on organizing the configuration/wiring of your application to be cleaner.

  1. Using MEF and Castle Windsor to improve decoupling in your architecture
  2. NHibernate and WPF: The GuyWire - Although it's written in the context of WPF, the same concept would apply to a webapp.


I use Windsor Castle, other people say that Structure Map is really good, but basically they all do the job


S#arp Architecture is admittedly a lot more than just IoC. It uses Castle/Windsor for IoC.

I would recommend it as a larger set of best practices for the framework of your MVC application.


I have used Unity and it is good.


Danial Cazzulino has a bunch (scrunch?) of screencasts on creating the Funq DI Container. Funq is lightweight and fast but lacks some of the bells and whistles of the larger, more established frameworks.

I use the Funq-derived Munq which is also lightweight and fast and is a simple way to add a DI Container to MVC3 projects via Nuget. Up to now I haven't found any need to move to a different framework - Munq has been very adequate.

PM> install-package Munq.MVC3 

This will add App_Start\MunqMvc3Startup.cs to the project, and this is where dependencies should be registered.

 اين مطلب بدون دخالت انساني عينا از اين آدرس کپي شده و تمامي مسوليت آن با ناشر اصلي است.

WCF - How to Increase Message Size Quota
How to get current page URL in MVC 3
Why is access to the path denied?
Login failed for user 'IIS APPPOOL\ASP.NET v4.0'
How to call javascript function from code-behind
ASP.NET Web Application Message Box

Response.Redirect to new window
Call a stored procedure with parameter in c#
An ASP.NET setting has been detected that does not apply in Integrated managed pipeline mode
How to get current page URL in MVC 3
Read data from SqlDataReader
Get current date only in C#