Documentation Coverage Report
Current view: top level - Azure/Cqrs.Azure.BlobStorage - EventDataTableEntity.cs Hit Total Coverage
Version: 2.2 Artefacts: 3 3 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.Azure.BlobStorage
      14             : {
      15             :         /// <summary>
      16             :         /// A projection/entity especially designed to work with Azure Table storage.
      17             :         /// </summary>
      18             :         [Serializable]
      19             :         [DataContract]
      20             :         public class EventDataTableEntity<TEventData>
      21             :                 : TableEntity<TEventData>
      22             :                 , IEventDataTableEntity<TEventData>
      23             :                 where TEventData : EventData
      24           1 :         {
      25             :                 /// <summary>
      26             :                 /// Instantiates a new instance of <see cref="EventDataTableEntity{TEntity}"/> specificly setting <see cref="Microsoft.WindowsAzure.Storage.Table.TableEntity.PartitionKey"/> and <see cref="Microsoft.WindowsAzure.Storage.Table.TableEntity.RowKey"/>.
      27             :                 /// </summary>
      28           1 :                 public EventDataTableEntity(TEventData eventData, bool isCorrelationIdTableStorageStore = false)
      29             :                 {
      30             :                         PartitionKey = StorageStore<object, object>.GetSafeStorageKey(isCorrelationIdTableStorageStore ? eventData.CorrelationId.ToString("N") : eventData.AggregateId);
      31             :                         RowKey = StorageStore<object, object>.GetSafeStorageKey(eventData.EventId.ToString("N"));
      32             :                         _eventData = eventData;
      33             :                         _eventDataContent = Serialise(EventData);
      34             :                 }
      35             : 
      36             :                 /// <summary>
      37             :                 /// Instantiates a new instance of <see cref="EventDataTableEntity{TEntity}"/>.
      38             :                 /// </summary>
      39           1 :                 public EventDataTableEntity()
      40             :                 {
      41             :                 }
      42             : 
      43             :                 private TEventData _eventData;
      44             : 
      45             :                 /// <summary>
      46             :                 /// Gets or sets the <typeparamref name="TEventData"/>.
      47             :                 /// </summary>
      48             :                 [DataMember]
      49             :                 public TEventData EventData
      50             :                 {
      51             :                         get { return _eventData; }
      52             :                         set { _eventData = value; }
      53             :                 }
      54             : 
      55             :                 private string _eventDataContent;
      56             : 
      57             :                 /// <summary>
      58             :                 /// Gets or sets a serialised version.
      59             :                 /// </summary>
      60             :                 [DataMember]
      61             :                 public string EventDataContent
      62             :                 {
      63             :                         get
      64             :                         {
      65             :                                 return _eventDataContent;
      66             :                         }
      67             :                         set
      68             :                         {
      69             :                                 _eventDataContent = value;
      70             :                                 _eventData = Deserialise(value);
      71             :                         }
      72             :                 }
      73             :         }
      74             : }

Generated by: LCOV version 1.10