Skip to content
This repository has been archived by the owner on Jan 24, 2021. It is now read-only.

Commit

Permalink
Merge pull request #1784 from khellang/request-container-context
Browse files Browse the repository at this point in the history
Pass NancyContext to CreateRequestContainer
  • Loading branch information
horsdal committed Jan 20, 2015
2 parents b93cb1f + 839dbea commit 1f96d38
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 5 deletions.
3 changes: 2 additions & 1 deletion src/Nancy.Testing/ConfigurableBootstrapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -321,8 +321,9 @@ protected override void ConfigureApplicationContainer(TinyIoCContainer container
/// <summary>
/// Creates a per request child/nested container
/// </summary>
/// <param name="context">Current context</param>
/// <returns>Request container instance</returns>
protected override TinyIoCContainer CreateRequestContainer()
protected override TinyIoCContainer CreateRequestContainer(NancyContext context)
{
return this.ApplicationContainer.GetChildContainer();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ protected override void RegisterCollectionTypes(
}
}

protected override FakeContainer CreateRequestContainer()
protected override FakeContainer CreateRequestContainer(NancyContext context)
{
return new FakeContainer(this.ApplicationContainer);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ namespace Nancy.Bootstrapper
{
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;

/// <summary>
Expand Down Expand Up @@ -153,7 +154,7 @@ protected TContainer GetConfiguredRequestContainer(NancyContext context)

if (requestContainer == null)
{
requestContainer = this.CreateRequestContainer();
requestContainer = this.CreateRequestContainer(context);

context.Items[this.ContextKey] = requestContainer;

Expand Down Expand Up @@ -188,8 +189,9 @@ protected override sealed void RegisterModules(TContainer container, IEnumerable
/// <summary>
/// Creates a per request child/nested container
/// </summary>
/// <param name="context">Current context</param>
/// <returns>Request container instance</returns>
protected abstract TContainer CreateRequestContainer();
protected abstract TContainer CreateRequestContainer(NancyContext context);

/// <summary>
/// Register the given module types into the request container
Expand Down
3 changes: 2 additions & 1 deletion src/Nancy/DefaultNancyBootstrapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -176,8 +176,9 @@ protected override void RegisterInstances(TinyIoCContainer container, IEnumerabl
/// <summary>
/// Creates a per request child/nested container
/// </summary>
/// <param name="context">Current context</param>
/// <returns>Request container instance</returns>
protected override sealed TinyIoCContainer CreateRequestContainer()
protected override TinyIoCContainer CreateRequestContainer(NancyContext context)
{
return this.ApplicationContainer.GetChildContainer();
}
Expand Down

0 comments on commit 1f96d38

Please sign in to comment.