From d5c822c143771f79d297a7371f33c812ec6d35a3 Mon Sep 17 00:00:00 2001 From: "chris.watts90@outlook.com" Date: Fri, 18 Oct 2019 09:42:49 +0100 Subject: [PATCH] weird formatting changes again --- .../WindowsDataCenter/App.config | 104 +++++++++--------- .../App_Start/Ninject.Web.Common.cs | 66 +++++++++++ .../WindowsDataCenter.csproj.user | 10 +- .../WindowsDataCenter/packages.config | 63 +++++------ .../WindowsDataServiceHost/App.config | 94 ++++++++-------- .../WindowsDataServiceHost/packages.config | 14 +-- 6 files changed, 209 insertions(+), 142 deletions(-) create mode 100644 DataCenter_Windows/WindowsDataCenter/WindowsDataCenter/App_Start/Ninject.Web.Common.cs diff --git a/DataCenter_Windows/WindowsDataCenter/WindowsDataCenter/App.config b/DataCenter_Windows/WindowsDataCenter/WindowsDataCenter/App.config index 0dd4b37..ecb9bb0 100644 --- a/DataCenter_Windows/WindowsDataCenter/WindowsDataCenter/App.config +++ b/DataCenter_Windows/WindowsDataCenter/WindowsDataCenter/App.config @@ -1,53 +1,53 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/DataCenter_Windows/WindowsDataCenter/WindowsDataCenter/App_Start/Ninject.Web.Common.cs b/DataCenter_Windows/WindowsDataCenter/WindowsDataCenter/App_Start/Ninject.Web.Common.cs new file mode 100644 index 0000000..72d1261 --- /dev/null +++ b/DataCenter_Windows/WindowsDataCenter/WindowsDataCenter/App_Start/Ninject.Web.Common.cs @@ -0,0 +1,66 @@ +[assembly: WebActivatorEx.PreApplicationStartMethod(typeof(WindowsDataCenter.App_Start.NinjectWebCommon), "Start")] +[assembly: WebActivatorEx.ApplicationShutdownMethodAttribute(typeof(WindowsDataCenter.App_Start.NinjectWebCommon), "Stop")] + +namespace WindowsDataCenter.App_Start +{ + using System; + using System.Web; + + using Microsoft.Web.Infrastructure.DynamicModuleHelper; + + using Ninject; + using Ninject.Web.Common; + using Ninject.Web.Common.WebHost; + + public static class NinjectWebCommon + { + private static readonly Bootstrapper bootstrapper = new Bootstrapper(); + + /// + /// Starts the application + /// + public static void Start() + { + DynamicModuleUtility.RegisterModule(typeof(OnePerRequestHttpModule)); + DynamicModuleUtility.RegisterModule(typeof(NinjectHttpModule)); + bootstrapper.Initialize(CreateKernel); + } + + /// + /// Stops the application. + /// + public static void Stop() + { + bootstrapper.ShutDown(); + } + + /// + /// Creates the kernel that will manage your application. + /// + /// The created kernel. + private static IKernel CreateKernel() + { + var kernel = new StandardKernel(); + try + { + kernel.Bind>().ToMethod(ctx => () => new Bootstrapper().Kernel); + kernel.Bind().To(); + RegisterServices(kernel); + return kernel; + } + catch + { + kernel.Dispose(); + throw; + } + } + + /// + /// Load your modules or register your services here! + /// + /// The kernel. + private static void RegisterServices(IKernel kernel) + { + } + } +} \ No newline at end of file diff --git a/DataCenter_Windows/WindowsDataCenter/WindowsDataCenter/WindowsDataCenter.csproj.user b/DataCenter_Windows/WindowsDataCenter/WindowsDataCenter/WindowsDataCenter.csproj.user index ca1d04b..1efe784 100644 --- a/DataCenter_Windows/WindowsDataCenter/WindowsDataCenter/WindowsDataCenter.csproj.user +++ b/DataCenter_Windows/WindowsDataCenter/WindowsDataCenter/WindowsDataCenter.csproj.user @@ -1,6 +1,6 @@ - - - - ProjectFiles - + + + + ProjectFiles + \ No newline at end of file diff --git a/DataCenter_Windows/WindowsDataCenter/WindowsDataCenter/packages.config b/DataCenter_Windows/WindowsDataCenter/WindowsDataCenter/packages.config index 1535601..027aa92 100644 --- a/DataCenter_Windows/WindowsDataCenter/WindowsDataCenter/packages.config +++ b/DataCenter_Windows/WindowsDataCenter/WindowsDataCenter/packages.config @@ -1,32 +1,33 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/DataCenter_Windows/WindowsDataCenter/WindowsDataServiceHost/App.config b/DataCenter_Windows/WindowsDataCenter/WindowsDataServiceHost/App.config index 2677a94..26fa84b 100644 --- a/DataCenter_Windows/WindowsDataCenter/WindowsDataServiceHost/App.config +++ b/DataCenter_Windows/WindowsDataCenter/WindowsDataServiceHost/App.config @@ -1,48 +1,48 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/DataCenter_Windows/WindowsDataCenter/WindowsDataServiceHost/packages.config b/DataCenter_Windows/WindowsDataCenter/WindowsDataServiceHost/packages.config index b50cb7b..a23faf9 100644 --- a/DataCenter_Windows/WindowsDataCenter/WindowsDataServiceHost/packages.config +++ b/DataCenter_Windows/WindowsDataCenter/WindowsDataServiceHost/packages.config @@ -1,8 +1,8 @@ - - - - - - - + + + + + + + \ No newline at end of file