Documentation Coverage Report
Current view: top level - Azure/Cqrs.Azure.EventHub - DefaultEventProcessorFactory.cs Hit Total Coverage
Version: 4.0 Artefacts: 3 3 100.0 %
Date: 2019-11-24 03:15:41

          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             : #if NET452
      11             : using Microsoft.ServiceBus.Messaging;
      12             : #endif
      13             : #if NETCOREAPP3_0
      14             : using Microsoft.Azure.EventHubs;
      15             : using Microsoft.Azure.EventHubs.Processor;
      16             : #endif
      17             : 
      18             : namespace Cqrs.Azure.ServiceBus
      19             : {
      20             :         /// <summary>
      21             :         /// Represents the factory for the default event processor.
      22             :         /// </summary>
      23             :         /// <typeparam name="TEventProcessor">The type of the event.</typeparam>
      24             :         internal class DefaultEventProcessorFactory<TEventProcessor>
      25             :                 : IEventProcessorFactory
      26             :                 where TEventProcessor : IEventProcessor
      27             :         {
      28             :                 protected TEventProcessor Instance { get; set; }
      29             : 
      30             :                 /// <summary>
      31             :                 /// Initializes a new instance of the <see cref="T:Microsoft.ServiceBus.Messaging.DefaultEventProcessorFactory`1"/> class.
      32             :                 /// </summary>
      33           1 :                 public DefaultEventProcessorFactory()
      34             :                 {
      35             :                 }
      36             : 
      37             :                 /// <summary>
      38             :                 /// Initializes a new instance of the <see cref="T:Microsoft.ServiceBus.Messaging.DefaultEventProcessorFactory`1"/> class using the specified instance.
      39             :                 /// </summary>
      40             :                 /// <param name="instance">The instance.</param>
      41           1 :                 public DefaultEventProcessorFactory(TEventProcessor instance)
      42             :                 {
      43             :                         Instance = instance;
      44             :                 }
      45             : 
      46             :                 /// <summary>
      47             :                 /// Creates an event processor.
      48             :                 /// </summary>
      49             :                 /// <param name="context">The partition context.</param>
      50             :                 /// <returns>
      51             :                 /// The created event processor.
      52             :                 /// </returns>
      53           1 :                 public IEventProcessor CreateEventProcessor(PartitionContext context)
      54             :                 {
      55             :                         if (Instance == null)
      56             :                                 return Activator.CreateInstance<TEventProcessor>();
      57             :                         return Instance;
      58             :                 }
      59             :         }
      60             : }

Generated by: LCOV version 1.13