Created
January 31, 2011 23:05
-
-
Save vquaiato/805024 to your computer and use it in GitHub Desktop.
Arquivo criado pelo NuGet no install do Ninject.MVC3
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Web.Mvc; | |
using Ninject; | |
using Ninject.Mvc3; | |
[assembly: WebActivator.PreApplicationStartMethod(typeof(MvcApplication1.AppStart_NinjectMVC3), "Start")] | |
namespace MvcApplication1 { | |
public static class AppStart_NinjectMVC3 { | |
public static void RegisterServices(IKernel kernel) { | |
//kernel.Bind<IThingRepository>().To<SqlThingRepository>(); | |
} | |
public static void Start() { | |
// Create Ninject DI Kernel | |
IKernel kernel = new StandardKernel(); | |
// Register services with our Ninject DI Container | |
RegisterServices(kernel); | |
// Tell ASP.NET MVC 3 to use our Ninject DI Container | |
DependencyResolver.SetResolver(new NinjectServiceLocator(kernel)); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment