LCOV - code coverage report
Current view: top level - Akka.Net/Cqrs.Akka/Domain/Factories - AkkaAggregateFactory.cs Hit Total Coverage
Test: doc-coverage.info Lines: 0 3 0.0 %
Date: 2017-07-26

          Line data    Source code
       1             : #region Copyright
       2             : // // -----------------------------------------------------------------------
       3             : // // <copyright company="cdmdotnet Limited">
       4             : // //   Copyright cdmdotnet Limited. All rights reserved.
       5             : // // </copyright>
       6             : // // -----------------------------------------------------------------------
       7             : #endregion
       8             : 
       9             : using System;
      10             : using Cqrs.Configuration;
      11             : using Cqrs.Domain.Factories;
      12             : 
      13             : namespace Cqrs.Akka.Domain.Factories
      14             : {
      15             :         public class AkkaAggregateFactory<TAuthenticationToken> : AggregateFactory
      16           0 :         {
      17             :                 protected IAkkaAggregateResolver AggregateResolver { get; private set; }
      18             : 
      19           0 :                 public AkkaAggregateFactory(IDependencyResolver dependencyResolver, IAkkaAggregateResolver aggregateResolver)
      20             :                         : base(dependencyResolver)
      21             :                 {
      22             :                         AggregateResolver = aggregateResolver;
      23             :                 }
      24             : 
      25           0 :                 public override TAggregateRoot CreateAggregate<TAggregateRoot>(Guid? rsn = null, bool tryDependencyResolutionFirst = true)
      26             :                 {
      27             :                         if (rsn == null)
      28             :                                 rsn = Guid.NewGuid();
      29             : 
      30             :                         try
      31             :                         {
      32             :                                 var rawProxy = new AkkaAggregateRootProxy<TAuthenticationToken, TAggregateRoot>
      33             :                                 {
      34             :                                         ActorReference = AggregateResolver.ResolveActor<TAggregateRoot, TAuthenticationToken>(rsn.Value)
      35             :                                 };
      36             :                                 return rawProxy.Aggregate;
      37             :                         }
      38             :                         catch (Exception)
      39             :                         {
      40             :                                 return base.CreateAggregate<TAggregateRoot>();
      41             :                         }
      42             :                 }
      43             :         }
      44             : }

Generated by: LCOV version 1.10