[assembly: WebActivator.PreApplicationStartMethod(typeof($rootnamespace$.App_Start.NinjectMVC3), "Start")]
[assembly: WebActivator.ApplicationShutdownMethodAttribute(typeof($rootnamespace$.App_Start.NinjectMVC3), "Stop")]
namespace $rootnamespace$.App_Start
{
using System.Reflection;
using Microsoft.Web.Infrastructure.DynamicModuleHelper;
using Ninject;
using Ninject.Web.Mvc;
public static class NinjectMVC3
{
private static readonly Bootstrapper bootstrapper = new Bootstrapper();
///
/// Starts the application
///
public static void Start()
{
DynamicModuleUtility.RegisterModule(typeof(OnePerRequestModule));
DynamicModuleUtility.RegisterModule(typeof(HttpApplicationInitializationModule));
bootstrapper.Initialize(CreateKernel);
}
///
/// Stops the application.
///
public static void Stop()
{
bootstrapper.ShutDown();
}
///
/// Creates the kernel that will manage your application.
///
/// The created kernel.
private static IKernel CreateKernel()
{
var kernel = new StandardKernel();
RegisterServices(kernel);
return kernel;
}
///
/// Load your modules or register your services here!
///
/// The kernel.
private static void RegisterServices(IKernel kernel)
{
}
}
}