weird formatting changes again
This commit is contained in:
parent
7a779b81b8
commit
d5c822c143
@ -0,0 +1,66 @@
|
|||||||
|
[assembly: WebActivatorEx.PreApplicationStartMethod(typeof(WindowsDataCenter.App_Start.NinjectWebCommon), "Start")]
|
||||||
|
[assembly: WebActivatorEx.ApplicationShutdownMethodAttribute(typeof(WindowsDataCenter.App_Start.NinjectWebCommon), "Stop")]
|
||||||
|
|
||||||
|
namespace WindowsDataCenter.App_Start
|
||||||
|
{
|
||||||
|
using System;
|
||||||
|
using System.Web;
|
||||||
|
|
||||||
|
using Microsoft.Web.Infrastructure.DynamicModuleHelper;
|
||||||
|
|
||||||
|
using Ninject;
|
||||||
|
using Ninject.Web.Common;
|
||||||
|
using Ninject.Web.Common.WebHost;
|
||||||
|
|
||||||
|
public static class NinjectWebCommon
|
||||||
|
{
|
||||||
|
private static readonly Bootstrapper bootstrapper = new Bootstrapper();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Starts the application
|
||||||
|
/// </summary>
|
||||||
|
public static void Start()
|
||||||
|
{
|
||||||
|
DynamicModuleUtility.RegisterModule(typeof(OnePerRequestHttpModule));
|
||||||
|
DynamicModuleUtility.RegisterModule(typeof(NinjectHttpModule));
|
||||||
|
bootstrapper.Initialize(CreateKernel);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Stops the application.
|
||||||
|
/// </summary>
|
||||||
|
public static void Stop()
|
||||||
|
{
|
||||||
|
bootstrapper.ShutDown();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Creates the kernel that will manage your application.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>The created kernel.</returns>
|
||||||
|
private static IKernel CreateKernel()
|
||||||
|
{
|
||||||
|
var kernel = new StandardKernel();
|
||||||
|
try
|
||||||
|
{
|
||||||
|
kernel.Bind<Func<IKernel>>().ToMethod(ctx => () => new Bootstrapper().Kernel);
|
||||||
|
kernel.Bind<IHttpModule>().To<HttpApplicationInitializationHttpModule>();
|
||||||
|
RegisterServices(kernel);
|
||||||
|
return kernel;
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
kernel.Dispose();
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Load your modules or register your services here!
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="kernel">The kernel.</param>
|
||||||
|
private static void RegisterServices(IKernel kernel)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -23,10 +23,11 @@
|
|||||||
<package id="Ninject.Extensions.Xml" version="3.3.0" targetFramework="net452" />
|
<package id="Ninject.Extensions.Xml" version="3.3.0" targetFramework="net452" />
|
||||||
<package id="Ninject.Web.Common" version="3.3.1" targetFramework="net452" />
|
<package id="Ninject.Web.Common" version="3.3.1" targetFramework="net452" />
|
||||||
<package id="Ninject.Web.Common.OwinHost" version="3.3.1" targetFramework="net452" />
|
<package id="Ninject.Web.Common.OwinHost" version="3.3.1" targetFramework="net452" />
|
||||||
|
<package id="Ninject.Web.Common.WebHost" version="3.3.1" targetFramework="net452" />
|
||||||
<package id="Ninject.Web.WebApi" version="3.3.0" targetFramework="net452" />
|
<package id="Ninject.Web.WebApi" version="3.3.0" targetFramework="net452" />
|
||||||
<package id="Ninject.Web.WebApi.OwinHost" version="3.3.0" targetFramework="net452" />
|
<package id="Ninject.Web.WebApi.OwinHost" version="3.3.0" targetFramework="net452" />
|
||||||
<package id="Owin" version="1.0" targetFramework="net452" />
|
<package id="Owin" version="1.0" targetFramework="net452" />
|
||||||
<package id="RazorEngine" version="3.7.2" targetFramework="net452" />
|
<package id="RazorEngine" version="3.7.2" targetFramework="net452" />
|
||||||
<package id="System.Data.SQLite.Core" version="1.0.104.0" targetFramework="net452" />
|
<package id="System.Data.SQLite.Core" version="1.0.104.0" targetFramework="net452" />
|
||||||
<package id="WebActivatorEx" version="2.0" targetFramework="net452" />
|
<package id="WebActivatorEx" version="2.2.0" targetFramework="net452" />
|
||||||
</packages>
|
</packages>
|
||||||
Loading…
Reference in New Issue
Block a user