LCOV - code coverage report
Current view: top level - Cqrs/Events - DtoAggregateEvent.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 System.Collections.Generic;
      11             : using System.Runtime.Serialization;
      12             : using Cqrs.Domain;
      13             : using Cqrs.Messages;
      14             : 
      15             : namespace Cqrs.Events
      16             : {
      17             :         [Serializable]
      18             :         [DataContract]
      19             :         public class DtoAggregateEvent<TAuthenticationToken, TDto> : IEvent<TAuthenticationToken>
      20             :                 where TDto : IDto
      21           0 :         {
      22             :                 [DataMember]
      23             :                 public TDto Original { get; private set; }
      24             : 
      25             :                 [DataMember]
      26             :                 public TDto New { get; private set; }
      27             : 
      28           0 :                 public DtoAggregateEvent(Guid id, TDto original, TDto @new)
      29             :                 {
      30             :                         Id = id;
      31             :                         Original = original;
      32             :                         New = @new;
      33             :                 }
      34             : 
      35             :                 [DataMember]
      36             :                 public Guid Id { get; set; }
      37             : 
      38             :                 [DataMember]
      39             :                 public int Version { get; set; }
      40             : 
      41             :                 [DataMember]
      42             :                 public DateTimeOffset TimeStamp { get; set; }
      43             : 
      44           0 :                 public DtoAggregateEventType GetEventType()
      45             :                 {
      46             :                         if (New != null && Original == null)
      47             :                                 return DtoAggregateEventType.Created;
      48             :                         if (New != null && Original != null)
      49             :                                 return DtoAggregateEventType.Updated;
      50             :                         if (New == null && Original != null)
      51             :                                 return DtoAggregateEventType.Deleted;
      52             :                         return DtoAggregateEventType.Unknown;
      53             :                 }
      54             : 
      55             :                 #region Implementation of IMessageWithAuthenticationToken<TAuthenticationToken>
      56             : 
      57             :                 [DataMember]
      58             :                 public TAuthenticationToken AuthenticationToken { get; set; }
      59             : 
      60             :                 #endregion
      61             : 
      62             :                 #region Implementation of IMessage
      63             : 
      64             :                 [DataMember]
      65             :                 public Guid CorrelationId { get; set; }
      66             : 
      67             :                 [DataMember]
      68             :                 [Obsolete("Use Frameworks, It's far more flexible and OriginatingFramework")]
      69             :                 public FrameworkType Framework { get; set; }
      70             : 
      71             :                 /// <summary>
      72             :                 /// The originating framework this message was sent from.
      73             :                 /// </summary>
      74             :                 [DataMember]
      75             :                 public string OriginatingFramework { get; set; }
      76             : 
      77             :                 /// <summary>
      78             :                 /// The frameworks this <see cref="IMessage"/> has been delivered to/sent via already.
      79             :                 /// </summary>
      80             :                 [DataMember]
      81             :                 public IEnumerable<string> Frameworks { get; set; }
      82             : 
      83             :                 [Obsolete("Use CorrelationId")]
      84             :                 [DataMember]
      85             :                 public Guid CorrolationId
      86             :                 {
      87             :                         get { return CorrelationId; }
      88             :                         set { CorrelationId = value; }
      89             :                 }
      90             : 
      91             :                 #endregion
      92             :         }
      93             : }

Generated by: LCOV version 1.10