Documentation Coverage Report
Current view: top level - Cqrs/Domain/Exceptions - EventsOutOfOrderException.cs Hit Total Coverage
Version: 2.2 Artefacts: 2 2 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.Runtime.Serialization;
      11             : using Cqrs.Events;
      12             : 
      13             : namespace Cqrs.Domain.Exceptions
      14             : {
      15             :         /// <summary>
      16             :         /// The <see cref="IEventStore{TAuthenticationToken}"/> gave <see cref="IEvent{TAuthenticationToken}">events</see> out of order
      17             :         /// or an expected <see cref="IEvent{TAuthenticationToken}"/> with a specific version number wasn't provided.
      18             :         /// </summary>
      19             :         [Serializable]
      20             :         public class EventsOutOfOrderException : Exception
      21           1 :         {
      22             :                 /// <summary>
      23             :                 /// Instantiate a new instance of <see cref="EventsOutOfOrderException"/> with the provided identifier of the <see cref="IAggregateRoot{TAuthenticationToken}"/> that had out of order <see cref="IEvent{TAuthenticationToken}" />.
      24             :                 /// and the <paramref name="currentVersion"/> the <see cref="IAggregateRoot{TAuthenticationToken}"/> was at and the <paramref name="providedEventVersion">the event version that was provided</paramref>.
      25             :                 /// </summary>
      26             :                 /// <param name="id">The identifier of the <see cref="IAggregateRoot{TAuthenticationToken}"/> that had <see cref="IEvent{TAuthenticationToken}">events</see>.</param>
      27             :                 /// <param name="aggregateType">The <see cref="Type"/> of the <see cref="IAggregateRoot{TAuthenticationToken}"/> that the <see cref="IEvent{TAuthenticationToken}"/> was trying to be saved on.</param>
      28             :                 /// <param name="currentVersion">The version number the <see cref="IAggregateRoot{TAuthenticationToken}"/> was at when it received an out of order <see cref="IEvent{TAuthenticationToken}"/>.</param>
      29             :                 /// <param name="providedEventVersion">The version number the <see cref="IEvent{TAuthenticationToken}"/> that was provided, that was out of order.</param>
      30           1 :                 public EventsOutOfOrderException(Guid id, Type aggregateType, int currentVersion, int providedEventVersion)
      31             :                         : base(string.Format("Eventstore gave event for aggregate '{0}' of type '{1}' out of order at version {2} by providing {3}", id, aggregateType.FullName, currentVersion, providedEventVersion))
      32             :                 {
      33             :                         Id = id;
      34             :                         AggregateType = aggregateType;
      35             :                         CurrentVersion = currentVersion;
      36             :                         ProvidedEventVersion = providedEventVersion;
      37             :                 }
      38             : 
      39             :                 /// <summary>
      40             :                 /// The identifier of the <see cref="IAggregateRoot{TAuthenticationToken}"/> that had out of order <see cref="IEvent{TAuthenticationToken}" />.
      41             :                 /// </summary>
      42             :                 [DataMember]
      43             :                 public Guid Id { get; set; }
      44             : 
      45             :                 /// <summary>
      46             :                 /// The <see cref="Type"/> of the <see cref="IAggregateRoot{TAuthenticationToken}"/> that had out of order <see cref="IEvent{TAuthenticationToken}" />.
      47             :                 /// </summary>
      48             :                 [DataMember]
      49             :                 public Type AggregateType { get; set; }
      50             : 
      51             :                 /// <summary>
      52             :                 /// The version number the <see cref="IAggregateRoot{TAuthenticationToken}"/> was at when it received an out of order <see cref="IEvent{TAuthenticationToken}"/>.
      53             :                 /// </summary>
      54             :                 [DataMember]
      55             :                 public int CurrentVersion { get; set; }
      56             : 
      57             :                 /// <summary>
      58             :                 /// The version number the <see cref="IEvent{TAuthenticationToken}"/> that was provided, that was out of order.
      59             :                 /// </summary>
      60             :                 [DataMember]
      61             :                 public int ProvidedEventVersion { get; set; }
      62             :         }
      63             : }

Generated by: LCOV version 1.10