Permalink
Browse files

Merge pull request #11 from scott-xu/master

Set ChildKernel's service scope to singleton by default
  • Loading branch information...
2 parents d484950 + da89cf1 commit 1374f212e5a823a8aa4c003aa421a9342aec1f76 @thecodejunkie thecodejunkie committed Jan 21, 2014
Showing with 4 additions and 3 deletions.
  1. +4 −3 src/Nancy.Bootstrappers.Ninject/NinjectNancyBootstrapper.cs
@@ -6,6 +6,7 @@
using Nancy.Bootstrapper;
using global::Ninject;
using global::Ninject.Extensions.ChildKernel;
+ using global::Ninject.Infrastructure;
/// <summary>
/// Nancy bootstrapper for the Ninject container.
@@ -128,9 +129,9 @@ protected override void RegisterInstances(IKernel container, IEnumerable<Instanc
/// Creates a per request child/nested container
/// </summary>
/// <returns>Request container instance</returns>
- protected override sealed IKernel CreateRequestContainer()
+ protected override IKernel CreateRequestContainer()
{
- return new ChildKernel(this.ApplicationContainer);
+ return new ChildKernel(this.ApplicationContainer, new NinjectSettings { DefaultScopeCallback = StandardScopeCallbacks.Singleton });
}
/// <summary>
@@ -144,7 +145,7 @@ protected override sealed IEnumerable<INancyModule> GetAllModules(IKernel contai
}
/// <summary>
- /// Retreive a specific module instance from the container
+ /// Retrieve a specific module instance from the container
/// </summary>
/// <param name="container">Container to use</param>
/// <param name="moduleType">Type of the module</param>

0 comments on commit 1374f21

Please sign in to comment.