parent
499279e2ac
commit
6870c2326f
@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Ninject" version="2.2.1.0" />
|
||||
</packages>
|
Binary file not shown.
@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Ninject" version="2.2.1.0" />
|
||||
</packages>
|
Binary file not shown.
@ -0,0 +1,183 @@
|
||||
<?xml version="1.0"?>
|
||||
<doc>
|
||||
<assembly>
|
||||
<name>Ninject.Web.Mvc</name>
|
||||
</assembly>
|
||||
<members>
|
||||
<member name="T:Ninject.Web.Mvc.ControllerMissingBindingResolver">
|
||||
<summary>
|
||||
Nissing binding resolver that creates a binding for unknown controllers.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Ninject.Web.Mvc.ControllerMissingBindingResolver.Resolve(Ninject.Infrastructure.Multimap{System.Type,Ninject.Planning.Bindings.IBinding},Ninject.Activation.IRequest)">
|
||||
<summary>
|
||||
Returns any bindings from the specified collection that match the specified request.
|
||||
</summary>
|
||||
<param name="bindings">The multimap of all registered bindings.</param>
|
||||
<param name="request">The request in question.</param>
|
||||
<returns>The series of matching bindings.</returns>
|
||||
</member>
|
||||
<member name="T:Ninject.Web.Mvc.FilterInjector">
|
||||
<summary>
|
||||
Injects all filters of a filter info.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:Ninject.Web.Mvc.IFilterInjector">
|
||||
<summary>
|
||||
Injects all filters of a FiltorInfo.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Ninject.Web.Mvc.IFilterInjector.Inject(System.Web.Mvc.FilterInfo)">
|
||||
<summary>
|
||||
Injects all filters of the specified filter info.
|
||||
</summary>
|
||||
<param name="filterInfo">The filter info.</param>
|
||||
</member>
|
||||
<member name="F:Ninject.Web.Mvc.FilterInjector.kernel">
|
||||
<summary>
|
||||
The kernel
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Ninject.Web.Mvc.FilterInjector.#ctor(Ninject.IKernel)">
|
||||
<summary>
|
||||
Initializes a new instance of the <see cref="T:Ninject.Web.Mvc.FilterInjector"/> class.
|
||||
</summary>
|
||||
<param name="kernel">The kernel.</param>
|
||||
</member>
|
||||
<member name="M:Ninject.Web.Mvc.FilterInjector.Inject(System.Web.Mvc.FilterInfo)">
|
||||
<summary>
|
||||
Injects all filters of the specified filter info.
|
||||
</summary>
|
||||
<param name="filterInfo">The filter info.</param>
|
||||
</member>
|
||||
<member name="T:Ninject.Web.Mvc.NinjectActionInvoker">
|
||||
<summary>
|
||||
An <see cref="T:System.Web.Mvc.IActionInvoker"/> that injects filters with dependencies.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="F:Ninject.Web.Mvc.NinjectActionInvoker.filterInjector">
|
||||
<summary>
|
||||
The injector for filter injection.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Ninject.Web.Mvc.NinjectActionInvoker.#ctor(Ninject.Web.Mvc.IFilterInjector)">
|
||||
<summary>
|
||||
Initializes a new instance of the <see cref="T:Ninject.Web.Mvc.NinjectActionInvoker"/> class.
|
||||
</summary>
|
||||
<param name="filterInjector">The filter injector.</param>
|
||||
</member>
|
||||
<member name="M:Ninject.Web.Mvc.NinjectActionInvoker.GetFilters(System.Web.Mvc.ControllerContext,System.Web.Mvc.ActionDescriptor)">
|
||||
<summary>
|
||||
Gets the filters for the specified request and action.
|
||||
</summary>
|
||||
<param name="controllerContext">The controller context.</param>
|
||||
<param name="actionDescriptor">The action descriptor.</param>
|
||||
<returns>The filters.</returns>
|
||||
</member>
|
||||
<member name="T:Ninject.Web.Mvc.NinjectAsyncActionInvoker">
|
||||
<summary>
|
||||
An <see cref="T:System.Web.Mvc.IActionInvoker"/> that injects filters with dependencies.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="F:Ninject.Web.Mvc.NinjectAsyncActionInvoker.filterInjector">
|
||||
<summary>
|
||||
The injector for filter injection.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Ninject.Web.Mvc.NinjectAsyncActionInvoker.#ctor(Ninject.Web.Mvc.IFilterInjector)">
|
||||
<summary>
|
||||
Initializes a new instance of the <see cref="T:Ninject.Web.Mvc.NinjectAsyncActionInvoker"/> class.
|
||||
</summary>
|
||||
<param name="filterInjector">The filter injector.</param>
|
||||
</member>
|
||||
<member name="M:Ninject.Web.Mvc.NinjectAsyncActionInvoker.GetFilters(System.Web.Mvc.ControllerContext,System.Web.Mvc.ActionDescriptor)">
|
||||
<summary>
|
||||
Gets the filters for the specified request and action.
|
||||
</summary>
|
||||
<param name="controllerContext">The controller context.</param>
|
||||
<param name="actionDescriptor">The action descriptor.</param>
|
||||
<returns>The filters.</returns>
|
||||
</member>
|
||||
<member name="T:Ninject.Web.Mvc.NinjectControllerFactory">
|
||||
<summary>
|
||||
A controller factory that creates <see cref="T:System.Web.Mvc.IController"/>s via Ninject.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Ninject.Web.Mvc.NinjectControllerFactory.#ctor(Ninject.IKernel)">
|
||||
<summary>
|
||||
Initializes a new instance of the <see cref="T:Ninject.Web.Mvc.NinjectControllerFactory"/> class.
|
||||
</summary>
|
||||
<param name="kernel">The kernel that should be used to create controllers.</param>
|
||||
</member>
|
||||
<member name="M:Ninject.Web.Mvc.NinjectControllerFactory.GetControllerInstance(System.Web.Routing.RequestContext,System.Type)">
|
||||
<summary>
|
||||
Gets a controller instance of type controllerType.
|
||||
</summary>
|
||||
<param name="requestContext">The request context.</param>
|
||||
<param name="controllerType">Type of controller to create.</param>
|
||||
<returns>The controller instance.</returns>
|
||||
</member>
|
||||
<member name="P:Ninject.Web.Mvc.NinjectControllerFactory.Kernel">
|
||||
<summary>
|
||||
Gets the kernel that will be used to create controllers.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:Ninject.Web.Mvc.NinjectHttpApplication">
|
||||
<summary>
|
||||
Defines an <see cref="T:System.Web.HttpApplication"/> that is controlled by a Ninject <see cref="T:Ninject.IKernel"/>.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="F:Ninject.Web.Mvc.NinjectHttpApplication.onePerRequestModule">
|
||||
<summary>
|
||||
The one per request module to release request scope at the end of the request
|
||||
</summary>
|
||||
</member>
|
||||
<member name="F:Ninject.Web.Mvc.NinjectHttpApplication.kernel">
|
||||
<summary>
|
||||
The ninject kernel of the application
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Ninject.Web.Mvc.NinjectHttpApplication.#ctor">
|
||||
<summary>
|
||||
Initializes a new instance of the <see cref="T:Ninject.Web.Mvc.NinjectHttpApplication"/> class.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Ninject.Web.Mvc.NinjectHttpApplication.Application_Start">
|
||||
<summary>
|
||||
Starts the application.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Ninject.Web.Mvc.NinjectHttpApplication.Application_End">
|
||||
<summary>
|
||||
Releases the kernel on application end.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Ninject.Web.Mvc.NinjectHttpApplication.CreateKernel">
|
||||
<summary>
|
||||
Creates the kernel that will manage your application.
|
||||
</summary>
|
||||
<returns>The created kernel.</returns>
|
||||
</member>
|
||||
<member name="M:Ninject.Web.Mvc.NinjectHttpApplication.CreateControllerFactory">
|
||||
<summary>
|
||||
Creates the controller factory that is used to create the controllers.
|
||||
</summary>
|
||||
<returns>The created controller factory.</returns>
|
||||
</member>
|
||||
<member name="M:Ninject.Web.Mvc.NinjectHttpApplication.OnApplicationStarted">
|
||||
<summary>
|
||||
Called when the application is started.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Ninject.Web.Mvc.NinjectHttpApplication.OnApplicationStopped">
|
||||
<summary>
|
||||
Called when the application is stopped.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Ninject.Web.Mvc.NinjectHttpApplication.Kernel">
|
||||
<summary>
|
||||
Gets the kernel.
|
||||
</summary>
|
||||
</member>
|
||||
</members>
|
||||
</doc>
|
@ -1,50 +0,0 @@
|
||||
//
|
||||
// Authors: Nate Kohari <nate@enkari.com>, Remo Gloor <remo.gloor@gmail.com>
|
||||
// Copyright (c) 2007-2010, Enkari, Ltd. and contributors
|
||||
//
|
||||
// Dual-licensed under the Apache License, Version 2.0, and the Microsoft Public License (Ms-PL).
|
||||
// See the file LICENSE.txt for details.
|
||||
//
|
||||
|
||||
namespace Ninject.Web.Mvc
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web.Mvc;
|
||||
using Ninject.Activation;
|
||||
using Ninject.Activation.Providers;
|
||||
using Ninject.Components;
|
||||
using Ninject.Infrastructure;
|
||||
using Ninject.Parameters;
|
||||
using Ninject.Planning.Bindings;
|
||||
using Ninject.Planning.Bindings.Resolvers;
|
||||
|
||||
/// <summary>
|
||||
/// Missing binding resolver that creates a binding for unknown controllers.
|
||||
/// </summary>
|
||||
public class ControllerMissingBindingResolver : NinjectComponent, IMissingBindingResolver
|
||||
{
|
||||
/// <summary>
|
||||
/// Returns any bindings from the specified collection that match the specified request.
|
||||
/// </summary>
|
||||
/// <param name="bindings">The multimap of all registered bindings.</param>
|
||||
/// <param name="request">The request in question.</param>
|
||||
/// <returns>The series of matching bindings.</returns>
|
||||
public IEnumerable<IBinding> Resolve(Multimap<Type, IBinding> bindings, IRequest request)
|
||||
{
|
||||
var service = request.Service;
|
||||
if (typeof(Controller).IsAssignableFrom(service))
|
||||
{
|
||||
var binding = new Binding(service) { ProviderCallback = StandardProvider.GetCreationCallback(service) };
|
||||
binding.Parameters.Add(
|
||||
typeof(AsyncController).IsAssignableFrom(service)
|
||||
? new PropertyValue("ActionInvoker", ctx => ctx.Kernel.Get<NinjectAsyncActionInvoker>())
|
||||
: new PropertyValue("ActionInvoker", ctx => ctx.Kernel.Get<NinjectActionInvoker>()));
|
||||
return new[] { binding };
|
||||
}
|
||||
|
||||
return Enumerable.Empty<IBinding>();
|
||||
}
|
||||
}
|
||||
}
|
@ -1,60 +0,0 @@
|
||||
//
|
||||
// Authors: Nate Kohari <nate@enkari.com>, Remo Gloor <remo.gloor@gmail.com>
|
||||
// Copyright (c) 2007-2010, Enkari, Ltd. and contributors
|
||||
//
|
||||
// Dual-licensed under the Apache License, Version 2.0, and the Microsoft Public License (Ms-PL).
|
||||
// See the file LICENSE.txt for details.
|
||||
//
|
||||
|
||||
namespace Ninject.Web.Mvc
|
||||
{
|
||||
using System.Linq;
|
||||
using System.Web.Mvc;
|
||||
|
||||
/// <summary>
|
||||
/// Injects all filters of a filter info.
|
||||
/// </summary>
|
||||
public class FilterInjector : IFilterInjector
|
||||
{
|
||||
/// <summary>
|
||||
/// The kernel
|
||||
/// </summary>
|
||||
private readonly IKernel kernel;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="FilterInjector"/> class.
|
||||
/// </summary>
|
||||
/// <param name="kernel">The kernel.</param>
|
||||
public FilterInjector(IKernel kernel)
|
||||
{
|
||||
this.kernel = kernel;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Injects all filters of the specified filter info.
|
||||
/// </summary>
|
||||
/// <param name="filterInfo">The filter info.</param>
|
||||
public void Inject(FilterInfo filterInfo)
|
||||
{
|
||||
foreach (IActionFilter filter in filterInfo.ActionFilters.Where(f => f != null))
|
||||
{
|
||||
this.kernel.Inject(filter);
|
||||
}
|
||||
|
||||
foreach (IAuthorizationFilter filter in filterInfo.AuthorizationFilters.Where(f => f != null))
|
||||
{
|
||||
this.kernel.Inject(filter);
|
||||
}
|
||||
|
||||
foreach (IExceptionFilter filter in filterInfo.ExceptionFilters.Where(f => f != null))
|
||||
{
|
||||
this.kernel.Inject(filter);
|
||||
}
|
||||
|
||||
foreach (IResultFilter filter in filterInfo.ResultFilters.Where(f => f != null))
|
||||
{
|
||||
this.kernel.Inject(filter);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,42 +0,0 @@
|
||||
//
|
||||
// Authors: Nate Kohari <nate@enkari.com>, Josh Close <narshe@gmail.com>
|
||||
// Copyright (c) 2007-2009, Enkari, Ltd.
|
||||
//
|
||||
// Dual-licensed under the Apache License, Version 2.0, and the Microsoft Public License (Ms-PL).
|
||||
// See the file LICENSE.txt for details.
|
||||
//
|
||||
|
||||
namespace Ninject.Web.Mvc
|
||||
{
|
||||
using System.Web.Mvc;
|
||||
|
||||
/// <summary>
|
||||
/// An <see cref="IActionInvoker"/> that injects filters with dependencies.
|
||||
/// </summary>
|
||||
public class NinjectActionInvoker : ControllerActionInvoker
|
||||
{
|
||||
private readonly IFilterInjector filterInjector;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="NinjectActionInvoker"/> class.
|
||||
/// </summary>
|
||||
/// <param name="filterInjector">The filter injector.</param>
|
||||
public NinjectActionInvoker(IFilterInjector filterInjector)
|
||||
{
|
||||
this.filterInjector = filterInjector;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the filters for the specified request and action.
|
||||
/// </summary>
|
||||
/// <param name="controllerContext">The controller context.</param>
|
||||
/// <param name="actionDescriptor">The action descriptor.</param>
|
||||
/// <returns>The filters.</returns>
|
||||
protected override FilterInfo GetFilters(ControllerContext controllerContext, ActionDescriptor actionDescriptor)
|
||||
{
|
||||
FilterInfo filterInfo = base.GetFilters(controllerContext, actionDescriptor);
|
||||
this.filterInjector.Inject(filterInfo);
|
||||
return filterInfo;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,43 +0,0 @@
|
||||
//
|
||||
// Authors: Nate Kohari <nate@enkari.com>, Josh Close <narshe@gmail.com>
|
||||
// Copyright (c) 2007-2009, Enkari, Ltd.
|
||||
//
|
||||
// Dual-licensed under the Apache License, Version 2.0, and the Microsoft Public License (Ms-PL).
|
||||
// See the file LICENSE.txt for details.
|
||||
//
|
||||
|
||||
namespace Ninject.Web.Mvc
|
||||
{
|
||||
using System.Web.Mvc;
|
||||
using System.Web.Mvc.Async;
|
||||
|
||||
/// <summary>
|
||||
/// An <see cref="IActionInvoker"/> that injects filters with dependencies.
|
||||
/// </summary>
|
||||
public class NinjectAsyncActionInvoker : AsyncControllerActionInvoker
|
||||
{
|
||||
private readonly IFilterInjector filterInjector;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="NinjectAsyncActionInvoker"/> class.
|
||||
/// </summary>
|
||||
/// <param name="filterInjector">The filter injector.</param>
|
||||
public NinjectAsyncActionInvoker(IFilterInjector filterInjector)
|
||||
{
|
||||
this.filterInjector = filterInjector;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the filters for the specified request and action.
|
||||
/// </summary>
|
||||
/// <param name="controllerContext">The controller context.</param>
|
||||
/// <param name="actionDescriptor">The action descriptor.</param>
|
||||
/// <returns>The filters.</returns>
|
||||
protected override FilterInfo GetFilters(ControllerContext controllerContext, ActionDescriptor actionDescriptor)
|
||||
{
|
||||
FilterInfo filterInfo = base.GetFilters(controllerContext, actionDescriptor);
|
||||
this.filterInjector.Inject(filterInfo);
|
||||
return filterInfo;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,88 +0,0 @@
|
||||
//
|
||||
// Authors: Nate Kohari <nate@enkari.com>, Josh Close <narshe@gmail.com>
|
||||
// Copyright (c) 2007-2009, Enkari, Ltd.
|
||||
//
|
||||
// Dual-licensed under the Apache License, Version 2.0, and the Microsoft Public License (Ms-PL).
|
||||
// See the file LICENSE.txt for details.
|
||||
//
|
||||
|
||||
namespace Ninject.Web.Mvc
|
||||
{
|
||||
using System;
|
||||
using System.Web.Mvc;
|
||||
using System.Web.Routing;
|
||||
|
||||
/// <summary>
|
||||
/// A controller factory that creates <see cref="IController"/>s via Ninject.
|
||||
/// </summary>
|
||||
public class NinjectControllerFactory : DefaultControllerFactory
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the kernel that will be used to create controllers.
|
||||
/// </summary>
|
||||
public IKernel Kernel { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="NinjectControllerFactory"/> class.
|
||||
/// </summary>
|
||||
/// <param name="kernel">The kernel that should be used to create controllers.</param>
|
||||
public NinjectControllerFactory(IKernel kernel)
|
||||
{
|
||||
Kernel = kernel;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets a controller instance of type controllerType.
|
||||
/// </summary>
|
||||
/// <param name="requestContext">The request context.</param>
|
||||
/// <param name="controllerType">Type of controller to create.</param>
|
||||
/// <returns>The controller instance.</returns>
|
||||
protected override IController GetControllerInstance(RequestContext requestContext, Type controllerType)
|
||||
{
|
||||
if(controllerType == null)
|
||||
{
|
||||
// let the base handle 404 errors with proper culture information
|
||||
return base.GetControllerInstance(requestContext, controllerType);
|
||||
}
|
||||
|
||||
var controller = Kernel.TryGet(controllerType) as IController;
|
||||
|
||||
if (controller == null)
|
||||
return base.GetControllerInstance(requestContext, controllerType);
|
||||
|
||||
/*
|
||||
var asyncController = controller as AsyncController;
|
||||
if (asyncController != null)
|
||||
{
|
||||
asyncController.ActionInvoker = this.CreateAsyncActionInvoker();
|
||||
}5
|
||||
else
|
||||
{
|
||||
var standardController = controller as Controller;
|
||||
if (standardController != null)
|
||||
standardController.ActionInvoker = CreateActionInvoker();
|
||||
}*/
|
||||
|
||||
return controller;
|
||||
}
|
||||
|
||||
/*
|
||||
/// <summary>
|
||||
/// Creates the action invoker.
|
||||
/// </summary>
|
||||
/// <returns>The action invoker.</returns>
|
||||
protected virtual NinjectActionInvoker CreateActionInvoker()
|
||||
{
|
||||
return new NinjectActionInvoker(Kernel);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates the action invoker.
|
||||
/// </summary>
|
||||
/// <returns>The action invoker.</returns>
|
||||
protected virtual NinjectAsyncActionInvoker CreateAsyncActionInvoker()
|
||||
{
|
||||
return new NinjectAsyncActionInvoker(Kernel);
|
||||
}*/
|
||||
}
|
||||
}
|
@ -1,104 +0,0 @@
|
||||
#region License
|
||||
//
|
||||
// Authors: Nate Kohari <nate@enkari.com>, Josh Close <narshe@gmail.com>
|
||||
// Copyright (c) 2007-2009, Enkari, Ltd.
|
||||
//
|
||||
// Dual-licensed under the Apache License, Version 2.0, and the Microsoft Public License (Ms-PL).
|
||||
// See the file LICENSE.txt for details.
|
||||
//
|
||||
#endregion
|
||||
#region Using Directives
|
||||
using System.Web;
|
||||
using System.Web.Mvc;
|
||||
using System.Web.Routing;
|
||||
using Ninject.Infrastructure;
|
||||
#endregion
|
||||
|
||||
namespace Ninject.Web.Mvc
|
||||
{
|
||||
using Ninject.Planning.Bindings.Resolvers;
|
||||
|
||||
/// <summary>
|
||||
/// Defines an <see cref="HttpApplication"/> that is controlled by a Ninject <see cref="IKernel"/>.
|
||||
/// </summary>
|
||||
public abstract class NinjectHttpApplication : HttpApplication, IHaveKernel
|
||||
{
|
||||
private static IKernel _kernel;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the kernel.
|
||||
/// </summary>
|
||||
public IKernel Kernel
|
||||
{
|
||||
get { return _kernel; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Starts the application.
|
||||
/// </summary>
|
||||
public void Application_Start()
|
||||
{
|
||||
lock (this)
|
||||
{
|
||||
_kernel = CreateKernel();
|
||||
|
||||
_kernel.Components.RemoveAll<IMissingBindingResolver>();
|
||||
_kernel.Components.Add<IMissingBindingResolver, ControllerMissingBindingResolver>();
|
||||
_kernel.Components.Add<IMissingBindingResolver, SelfBindingResolver>();
|
||||
|
||||
_kernel.Bind<RouteCollection>().ToConstant(RouteTable.Routes);
|
||||
_kernel.Bind<HttpContext>().ToMethod(ctx => HttpContext.Current).InTransientScope();
|
||||
_kernel.Bind<HttpContextBase>().ToMethod(ctx => new HttpContextWrapper(HttpContext.Current)).InTransientScope();
|
||||
_kernel.Bind<IFilterInjector>().To<FilterInjector>().InSingletonScope();
|
||||
|
||||
ControllerBuilder.Current.SetControllerFactory(CreateControllerFactory());
|
||||
|
||||
_kernel.Inject(this);
|
||||
|
||||
OnApplicationStarted();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Releases the kernel on application end.
|
||||
/// </summary>
|
||||
public void Application_End()
|
||||
{
|
||||
lock (this)
|
||||
{
|
||||
if (_kernel != null)
|
||||
{
|
||||
_kernel.Dispose();
|
||||
_kernel = null;
|
||||
}
|
||||
|
||||
OnApplicationStopped();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates the kernel that will manage your application.
|
||||
/// </summary>
|
||||
/// <returns>The created kernel.</returns>
|
||||
protected abstract IKernel CreateKernel();
|
||||
|
||||
/// <summary>
|
||||
/// Creates the controller factory that is used to create the controllers.
|
||||
/// </summary>
|
||||
/// <returns>The created controller factory.</returns>
|
||||
protected virtual NinjectControllerFactory CreateControllerFactory()
|
||||
{
|
||||
return new NinjectControllerFactory(Kernel);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Called when the application is started.
|
||||
/// </summary>
|
||||
protected virtual void OnApplicationStarted() { }
|
||||
|
||||
/// <summary>
|
||||
/// Called when the application is stopped.
|
||||
/// </summary>
|
||||
protected virtual void OnApplicationStopped() { }
|
||||
}
|
||||
}
|
@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Ninject" version="2.2.1.0" />
|
||||
</packages>
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
Binary file not shown.
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<repositories>
|
||||
<repository path="..\NzbDrone.Web\packages.config" />
|
||||
<repository path="..\NzbDrone.Core\packages.config" />
|
||||
<repository path="..\NzbDrone.Core.Test\packages.config" />
|
||||
</repositories>
|
Loading…
Reference in new issue