Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Ninject.Extensions.ContextPreservation dependency #27

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@

<ItemGroup>
<PackageReference Include="Microsoft.AspNet.WebApi.Owin" Version="5.2.3" />
<PackageReference Include="Ninject.Extensions.ContextPreservation" Version="3.3.1" />
<PackageReference Include="Ninject.Extensions.NamedScope" Version="3.3.0" />
<PackageReference Include="Ninject.Web.Common.OwinHost" Version="3.3.0" />
<PackageReference Include="StyleCop.Analyzers" Version="1.1.0-beta004">
Expand Down
6 changes: 6 additions & 0 deletions src/Ninject.Web.WebApi.OwinHost/OwinWebApiModule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ namespace Ninject.Web.WebApi.OwinHost
using System.Web.Http;
using System.Web.Http.Dependencies;

using Ninject.Extensions.ContextPreservation;
using Ninject.Modules;

/// <summary>
Expand Down Expand Up @@ -66,6 +67,11 @@ public override void VerifyRequiredModulesAreLoaded()
throw new InvalidOperationException("This module requires Ninject.Web.WebAPI extension");
}

if (!this.Kernel.HasModule(typeof(ContextPreservationModule).FullName))
{
throw new InvalidOperationException("This module requires Ninject.Extensions.ContextPreservation extension");
}

this.Rebind<IDependencyResolver>().To<OwinNinjectDependencyResolver>();

this.Kernel.Components.RemoveAll<IWebApiRequestScopeProvider>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@

<ItemGroup>
<PackageReference Include="Microsoft.AspNet.WebApi.SelfHost" Version="5.2.3" />
<PackageReference Include="Ninject.Extensions.ContextPreservation" Version="3.3.1" />
<PackageReference Include="Ninject.Extensions.NamedScope" Version="3.3.0" />
<PackageReference Include="Ninject.Web.Common.SelfHost" Version="3.3.0-rc1" />
<PackageReference Include="StyleCop.Analyzers" Version="1.1.0-beta004">
Expand Down
6 changes: 6 additions & 0 deletions src/Ninject.Web.WebApi.Selfhost/WebApiSelfHostModule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ namespace Ninject.Web.WebApi.Selfhost
using System.Web.Http.Dependencies;
using System.Web.Http.SelfHost;

using Ninject.Extensions.ContextPreservation;
using Ninject.Modules;
using Ninject.Web.Common.SelfHost;
using Ninject.Web.WebApi;
Expand Down Expand Up @@ -54,6 +55,11 @@ public override void VerifyRequiredModulesAreLoaded()
throw new InvalidOperationException("This module requires Ninject.Web.WebAPI extension");
}

if (!this.Kernel.HasModule(typeof(ContextPreservationModule).FullName))
{
throw new InvalidOperationException("This module requires Ninject.Extensions.ContextPreservation extension");
}

this.Rebind<IDependencyResolver>().To<NinjectSelfHostDependencyResolver>();

this.Kernel.Components.RemoveAll<IWebApiRequestScopeProvider>();
Expand Down