Request Lifetime Major bug fixed

I had a major bug in the RequestLifetime management code that did not show up when running tests using the Dev WebServer. This has been repaired and the updated packages are available from Nuget
  • Munq.IocContainer V3.1.6
  • Munq.MVC3 V3.1.5
  • Munq.ServiceLocator V3.1.5

I am also releasing the updated source here.

Announcement Jan. 21, 2012

Version 3.1.4 has been released on Nuget
Now disposes of IDisposable objects with RequestLifetime at the end of the HttpRequest.
Extension methods to make specifying Lifetime Managers easier.
Also update ServiceLocater and MVC3 packages to version 1.2 with a dependency on IocContainer >V3.1.4

Version 3.1 has been released on Nuget.
Corrects some minor bugs.
Adds support for Open Generics.

container.Register(typeof(IFoo<>), typeof(Foo<>));
var intFoo =container Resolve<IFoo<int>>();
var stringFoo =container.Resolve<IFoo<string>>();

Version 3 has been release. This release intends to make the Munq IOC Container production ready. This is being accomplished by:
  • Help file with detailed examples.
  • Automatic resolving of classes to the constructor with the most parameters. Each parameter is also resolved.
  • Improved thread safety.
  • Extensive code refactoring to reduce code repetition.
  • NuGet installation.
  • NuGet installation for MVC2 and MVC3
  • NuGet installation for Common Service Locator implementation.
  • Corrected Performance test. The original tests did not use the same lifetime model for each test. Munq still rules !

The old notes:

Additionally, I've borrowed Kzu's performance measurement app to benchmark Munq against other DI.Containers. See my Code Project article
for the numbers, or checkout my blog!99CC0775D5794768!211.entry. It just seems too good, but as it stands Munq is the FASTEST ( next to No-DI) in the running, closely followed by Funq.
The big names aren't even on the same planet :)

Project Description
My current interests lie in ASP.NET MVC, and how to create a framework and/or a project template that would meet my general project needs.

This release cleans up the code. After refactoring the Registration<TType> has been removed.
Download the latest release here


Munq.DI is a very small, fast dependency injection container designed for ASP.NET applications, both Webforms and MVC. It has, by design, limited features. The main goal has been to minimize the CPU required for Resolving types from the container.

Take a look, the container.cs file is only 120 lines and the registration object code only 64.

I've also created a MunqDIControllerFactor for ASP.NET MVC and a sample application. Included in the sample app is an example of using ASP.NET Themes to change CSS. The choice is stored in the user profile. I think I've created the worlds ugliest Theme, but I could be wrong. :)

This project was inspired Daniel Cazzulino’s (kzu) webcast series on creating Funq. a small, fast Dependency Injection Container using TDD. I noticed a few optimizations and refactorings that would improve the performance. After a series of discussions back and forth, Daniel made me a contributor to the codeplex project and I created Munq and TinyMunq. These where experimental versions to determine how to make Funq as fast as possible without sacrificing speed.


  • Container Registration Methods
    • public IRegistration Register<TType>(Func<Container, object> func)
    • public IRegistration Register<TType>(string name, Func<Container, object> func)
    • public IRegistration RegisterInstance<TType>(TType instance)
    • public IRegistration RegisterInstance<TType>(string name, TType instance)
    • public IRegistration Register(Type type, object func)
    • public IRegistration Register(string name, Type type, object func)
    • public IRegistration RegisterInstance(Type type, object instance)
    • public IRegistration RegisterInstance(string name, Type type, object instance)
  • Container Resolve Methods
    • public TType Resolve<TType>()
    • public TType Resolve<TType>(string name)
    • public object Resolve(Type type)
    • public object Resolve(string name, Type type)
    • public Func<TType> LazyResolve<TType>()
    • public Func<TType> LazyResolve<TType>(string name)
    • public Func<object> LazyResolve(Type type)
    • public Func<object> LazyResolve(string name, Type type)
  • Lifetime Management
    • Always New
    • Container Lifetime
    • Session Lifetime
    • Request Lifetime
    • Cached Lifetime

Last edited Apr 28, 2012 at 5:00 PM by mdennis, version 28