Documentation Coverage Report
Current view: top level - Ninject/Azure/Cqrs.Ninject.Azure.Wcf/Configuration - SimplifiedNinjectWcf.cs Hit Total Coverage
Version: 2.2 Artefacts: 5 5 100.0 %
Date: 2017-09-22

          Line data    Source code
       1             : #region Copyright
       2             : // // -----------------------------------------------------------------------
       3             : // // <copyright company="Chinchilla Software Limited">
       4             : // //   Copyright Chinchilla Software Limited. All rights reserved.
       5             : // // </copyright>
       6             : // // -----------------------------------------------------------------------
       7             : #endregion
       8             : 
       9             : using Cqrs.Authentication;
      10             : using Cqrs.Azure.ConfigurationManager;
      11             : using Cqrs.Configuration;
      12             : using Cqrs.Ninject.Configuration;
      13             : using Microsoft.Web.Infrastructure.DynamicModuleHelper;
      14             : using Ninject;
      15             : using Ninject.Web.Common;
      16             : 
      17             : [assembly: WebActivatorEx.PreApplicationStartMethod(typeof(Cqrs.Ninject.Azure.Wcf.Configuration.SimplifiedNinjectWcf), "Start", Order = 50)]
      18             : [assembly: WebActivatorEx.ApplicationShutdownMethodAttribute(typeof(Cqrs.Ninject.Azure.Wcf.Configuration.SimplifiedNinjectWcf), "Stop", Order = 50)]
      19             : 
      20             : namespace Cqrs.Ninject.Azure.Wcf.Configuration
      21             : {
      22             :         /// <summary>
      23             :         /// A <see cref="WebActivatorEx.PreApplicationStartMethodAttribute"/> that calls <see cref="Start"/>
      24             :         /// and <see cref="WebActivatorEx.ApplicationShutdownMethodAttribute"/> that calls <see cref="Stop"/>
      25             :         /// configuring Simplified SQL by wiring up <see cref="SimplifiedSqlModule{TAuthenticationToken}"/>.
      26             :         /// </summary>
      27             :         public static class SimplifiedNinjectWcf
      28           1 :         {
      29             :                 private static readonly Bootstrapper Bootstrapper = new Bootstrapper();
      30             : 
      31             :                 /// <summary>
      32             :                 /// Starts the application
      33             :                 /// </summary>
      34           1 :                 public static void Start()
      35             :                 {
      36             :                         DynamicModuleUtility.RegisterModule(typeof(OnePerRequestHttpModule));
      37             :                         DynamicModuleUtility.RegisterModule(typeof(NinjectHttpModule));
      38             :                         Bootstrapper.Initialize(CreateKernel);
      39             :                 }
      40             : 
      41             :                 /// <summary>
      42             :                 /// Stops the application.
      43             :                 /// </summary>
      44           1 :                 public static void Stop()
      45             :                 {
      46             :                         Bootstrapper.ShutDown();
      47             :                 }
      48             : 
      49             :                 /// <summary>
      50             :                 /// Creates the kernel that will manage your application.
      51             :                 /// </summary>
      52             :                 /// <returns>The created kernel.</returns>
      53             :                 private static IKernel CreateKernel()
      54             :                 {
      55             :                         return new WcfStartUp(new CloudConfigurationManager()).CreateKernel();
      56             :                 }
      57             : 
      58             :                 private class WcfStartUp : SimplifiedNinjectStartUp<WebHostModule>
      59             :                 {
      60             :                         /// <summary>
      61             :                         /// Instantiate a new instance of <see cref="WcfStartUp"/>
      62             :                         /// </summary>
      63           1 :                         public WcfStartUp(IConfigurationManager configurationManager)
      64             :                                 : base(configurationManager)
      65             :                         {
      66             :                         }
      67             : 
      68             :                         #region Overrides of SimplifiedNinjectStartUp<WebHostModule>
      69             : 
      70             :                         /// <summary>
      71             :                         /// Adds the <see cref="SimplifiedSqlModule{TAuthenticationToken}"/> into <see cref="NinjectDependencyResolver.ModulesToLoad"/>.
      72             :                         /// </summary>
      73           1 :                         protected override void AddSupplementryModules()
      74             :                         {
      75             :                                 NinjectDependencyResolver.ModulesToLoad.Insert(2, new SimplifiedSqlModule<SingleSignOnToken>());
      76             :                         }
      77             : 
      78             :                         #endregion
      79             :                 }
      80             :         }
      81             : }

Generated by: LCOV version 1.10