Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
extension for ninject providing integration with ASP.NET MVC
C#
branch: master

This branch is 109 commits behind ninject:master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
lib
src/Ninject.Web.Mvc
.gitignore
Ninject.Web.Mvc.sln
Ninject.Web.Mvc.sln.cache
README.markdown

README.markdown

This extension allows integration between the Ninject core and ASP.NET MVC projects. To use it, just make your HttpApplication (typically in Global.asax.cs) extend NinjectHttpApplication:

public class YourWebApplication : NinjectHttpApplication
{
  public override void OnApplicationStarted()
  {
    RegisterAllControllersIn("Some.Assembly.Name");
  }

  public override IKernel CreateKernel()
  {
    return new StandardKernel(new SomeModule(), new SomeOtherModule(), ...);

    // OR, to automatically load modules:

    var kernel = new StandardKernel();
    kernel.AutoLoadModules("~/bin");
    return kernel;
  }
}

Once you do this, your controllers will be activated via Ninject, meaning you can expose dependencies on their constructors (or properties, or methods) to request injections.

Something went wrong with that request. Please try again.