Documentation Coverage Report
Current view: top level - Ninject/Azure/Cqrs.Ninject.Azure.EventHub.CommandBus/Configuration - AzureCommandHubReceiverModule.cs Hit Total Coverage
Version: 2.2 Artefacts: 4 4 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 System;
      10             : using System.Linq;
      11             : using Cqrs.Azure.ServiceBus;
      12             : using Cqrs.Bus;
      13             : using Cqrs.Commands;
      14             : using Ninject.Modules;
      15             : 
      16             : namespace Cqrs.Azure.EventHub.CommandBus.Configuration
      17             : {
      18             :         /// <summary>
      19             :         /// A <see cref="INinjectModule"/> that wires up <see cref="AzureCommandBusReceiver{TAuthenticationToken}"/> as the <see cref="ICommandReceiver"/> and other require components.
      20             :         /// </summary>
      21             :         /// <typeparam name="TAuthenticationToken">The <see cref="Type"/> of the authentication token.</typeparam>
      22             :         public class AzureCommandHubReceiverModule<TAuthenticationToken> : NinjectModule
      23           1 :         {
      24             :                 #region Overrides of NinjectModule
      25             : 
      26             :                 /// <summary>
      27             :                 /// Loads the module into the kernel.
      28             :                 /// </summary>
      29           1 :                 public override void Load()
      30             :                 {
      31             :                         bool isMessageSerialiserBound = Kernel.GetBindings(typeof(IAzureBusHelper<TAuthenticationToken>)).Any();
      32             :                         if (!isMessageSerialiserBound)
      33             :                         {
      34             :                                 Bind<IAzureBusHelper<TAuthenticationToken>>()
      35             :                                         .To<AzureBusHelper<TAuthenticationToken>>()
      36             :                                         .InSingletonScope();
      37             :                         }
      38             : 
      39             :                         RegisterCommandHandlerRegistrar();
      40             :                         RegisterCommandMessageSerialiser();
      41             :                 }
      42             : 
      43             :                 #endregion
      44             : 
      45             :                 /// <summary>
      46             :                 /// Register the CQRS command handler registrar
      47             :                 /// </summary>
      48           1 :                 public virtual void RegisterCommandHandlerRegistrar()
      49             :                 {
      50             :                         Bind<ICommandHandlerRegistrar>()
      51             :                                 .To<AzureCommandBusReceiver<TAuthenticationToken>>()
      52             :                                 .InSingletonScope();
      53             :                 }
      54             : 
      55             :                 /// <summary>
      56             :                 /// Register the CQRS command handler message serialiser
      57             :                 /// </summary>
      58           1 :                 public virtual void RegisterCommandMessageSerialiser()
      59             :                 {
      60             :                         bool isMessageSerialiserBound = Kernel.GetBindings(typeof(IMessageSerialiser<TAuthenticationToken>)).Any();
      61             :                         if (!isMessageSerialiserBound)
      62             :                         {
      63             :                                 Bind<IMessageSerialiser<TAuthenticationToken>>()
      64             :                                         .To<MessageSerialiser<TAuthenticationToken>>()
      65             :                                         .InSingletonScope();
      66             :                         }
      67             :                 }
      68             :         }
      69             : }

Generated by: LCOV version 1.10