diff --git a/NzbDrone.Web/App_Start/AppHost.cs b/NzbDrone.Api/AppHost.cs similarity index 61% rename from NzbDrone.Web/App_Start/AppHost.cs rename to NzbDrone.Api/AppHost.cs index d493c4ca0..b036eef6f 100644 --- a/NzbDrone.Web/App_Start/AppHost.cs +++ b/NzbDrone.Api/AppHost.cs @@ -4,19 +4,26 @@ using System.Linq; using System.Reflection; using System.Web; using Funq; -using NzbDrone.Api.RequestModels; -using NzbDrone.Api.Services; +using Ninject; +using NzbDrone.Api.QualityProfiles; +using ServiceStack.ContainerAdapter.Ninject; using ServiceStack.WebHost.Endpoints; -namespace NzbDrone.Web.App_Start +namespace NzbDrone.Api { public class AppHost : AppHostBase { - public AppHost() //Tell ServiceStack the name and where to find your web services - : base("NzbDrone API", typeof(QualityProfileService).Assembly) { } + private IKernel _kernel; + + public AppHost(IKernel kernel) //Tell ServiceStack the name and where to find your web services + : base("NzbDrone API", typeof(QualityProfileService).Assembly) + { + _kernel = kernel; + } public override void Configure(Container container) { + container.Adapter = new NinjectContainerAdapter(_kernel); SetConfig(new EndpointHostConfig { ServiceStackHandlerFactoryPath = "api" }); Routes diff --git a/NzbDrone.Api/Filters/ValidApiRequestAttribute.cs b/NzbDrone.Api/Filters/ValidApiRequestAttribute.cs index 448c234df..61def76af 100644 --- a/NzbDrone.Api/Filters/ValidApiRequestAttribute.cs +++ b/NzbDrone.Api/Filters/ValidApiRequestAttribute.cs @@ -4,7 +4,6 @@ using System.Linq; using System.Text; using Ninject; using NzbDrone.Api.Exceptions; -using NzbDrone.Api.RequestModels; using NzbDrone.Core.Providers.Core; using ServiceStack.ServiceHost; using ServiceStack.ServiceInterface; diff --git a/NzbDrone.Api/RequestModels/IApiRequest.cs b/NzbDrone.Api/IApiRequest.cs similarity index 73% rename from NzbDrone.Api/RequestModels/IApiRequest.cs rename to NzbDrone.Api/IApiRequest.cs index e77a7fdfa..4dd6c052c 100644 --- a/NzbDrone.Api/RequestModels/IApiRequest.cs +++ b/NzbDrone.Api/IApiRequest.cs @@ -1,6 +1,6 @@ using System.Linq; -namespace NzbDrone.Api.RequestModels +namespace NzbDrone.Api { public interface IApiRequest { diff --git a/NzbDrone.Api/NzbDrone.Api.csproj b/NzbDrone.Api/NzbDrone.Api.csproj index 25bcb872c..5571af429 100644 --- a/NzbDrone.Api/NzbDrone.Api.csproj +++ b/NzbDrone.Api/NzbDrone.Api.csproj @@ -52,7 +52,7 @@ False - ..\packages\Ninject.2.2.1.4\lib\net40-Full\Ninject.dll + ..\packages\Ninject.3.0.1.10\lib\net40\Ninject.dll ..\packages\ServiceStack.3.9.25\lib\net35\ServiceStack.dll @@ -60,6 +60,9 @@ ..\packages\ServiceStack.Common.3.9.25\lib\net35\ServiceStack.Common.dll + + ..\packages\ServiceStack.ContainerAdapter.Ninject.1.0.4526.38581\lib\net40\ServiceStack.ContainerAdapter.Ninject.dll + ..\packages\ServiceStack.Common.3.9.25\lib\net35\ServiceStack.Interfaces.dll @@ -87,14 +90,13 @@ + - - - - + + - + @@ -109,6 +111,7 @@ NzbDrone.Core +