Documentation Coverage Report
Current view: top level - Azure/Cqrs.Azure.BlobStorage - EntityTableEntity.cs Hit Total Coverage
Version: 2.2 Artefacts: 3 3 100.0 %
Date: 2018-08-07 15:04:50

          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.Entities;
      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 EntityTableEntity<TEntity>
      21             :                 : TableEntity<TEntity>
      22             :                 , IEntityTableEntity<TEntity>
      23             :                 where TEntity : IEntity
      24           1 :         {
      25             :                 /// <summary>
      26             :                 /// Instantiates a new instance of <see cref="EntityTableEntity{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 EntityTableEntity(TEntity entity)
      29             :                 {
      30             :                         PartitionKey = StorageStore<object, object>.GetSafeStorageKey(entity.GetType().FullName);
      31             :                         RowKey = StorageStore<object, object>.GetSafeStorageKey(entity.Rsn.ToString("N"));
      32             :                         _entity = entity;
      33             :                         _entityContent = Serialise(Entity);
      34             :                 }
      35             : 
      36             :                 /// <summary>
      37             :                 /// Instantiates a new instance of <see cref="EntityTableEntity{TEntity}"/>.
      38             :                 /// </summary>
      39           1 :                 public EntityTableEntity()
      40             :                 {
      41             :                 }
      42             : 
      43             :                 private TEntity _entity;
      44             : 
      45             :                 /// <summary>
      46             :                 /// Gets or sets the <typeparamref name="TEntity"/>.
      47             :                 /// </summary>
      48             :                 [DataMember]
      49             :                 public TEntity Entity
      50             :                 {
      51             :                         get { return _entity; }
      52             :                         set { _entity = value; }
      53             :                 }
      54             : 
      55             :                 private string _entityContent;
      56             : 
      57             :                 /// <summary>
      58             :                 /// Gets or sets a serialised version.
      59             :                 /// </summary>
      60             :                 [DataMember]
      61             :                 public string EntityContent
      62             :                 {
      63             :                         get
      64             :                         {
      65             :                                 return _entityContent;
      66             :                         }
      67             :                         set
      68             :                         {
      69             :                                 _entityContent = value;
      70             :                                 _entity = Deserialise(value);
      71             :                         }
      72             :                 }
      73             :         }
      74             : }

Generated by: LCOV version 1.12