diff --git a/src/Ninject.Web.WebApi.OwinHost/Ninject.Web.WebApi.OwinHost.csproj b/src/Ninject.Web.WebApi.OwinHost/Ninject.Web.WebApi.OwinHost.csproj index 60d91fb..9e9cb2d 100644 --- a/src/Ninject.Web.WebApi.OwinHost/Ninject.Web.WebApi.OwinHost.csproj +++ b/src/Ninject.Web.WebApi.OwinHost/Ninject.Web.WebApi.OwinHost.csproj @@ -37,6 +37,7 @@ + diff --git a/src/Ninject.Web.WebApi.OwinHost/OwinWebApiModule.cs b/src/Ninject.Web.WebApi.OwinHost/OwinWebApiModule.cs index ecc79c2..37a4311 100644 --- a/src/Ninject.Web.WebApi.OwinHost/OwinWebApiModule.cs +++ b/src/Ninject.Web.WebApi.OwinHost/OwinWebApiModule.cs @@ -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; /// @@ -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().To(); this.Kernel.Components.RemoveAll(); diff --git a/src/Ninject.Web.WebApi.Selfhost/Ninject.Web.WebApi.Selfhost.csproj b/src/Ninject.Web.WebApi.Selfhost/Ninject.Web.WebApi.Selfhost.csproj index 56ce20c..a2a6bfe 100644 --- a/src/Ninject.Web.WebApi.Selfhost/Ninject.Web.WebApi.Selfhost.csproj +++ b/src/Ninject.Web.WebApi.Selfhost/Ninject.Web.WebApi.Selfhost.csproj @@ -37,6 +37,7 @@ + diff --git a/src/Ninject.Web.WebApi.Selfhost/WebApiSelfHostModule.cs b/src/Ninject.Web.WebApi.Selfhost/WebApiSelfHostModule.cs index e47e843..1436390 100644 --- a/src/Ninject.Web.WebApi.Selfhost/WebApiSelfHostModule.cs +++ b/src/Ninject.Web.WebApi.Selfhost/WebApiSelfHostModule.cs @@ -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; @@ -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().To(); this.Kernel.Components.RemoveAll();