Documentation Coverage Report
Current view: top level - Azure/Cqrs.Azure.Storage/DataStores - TableStorageDataStoreConnectionStringFactory.cs Hit Total Coverage
Version: 2.2 Artefacts: 4 4 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 Cqrs.Configuration;
      11             : using cdmdotnet.Logging;
      12             : using Cqrs.Azure.BlobStorage.DataStores;
      13             : using Cqrs.DataStores;
      14             : 
      15             : namespace Cqrs.Azure.Storage.DataStores
      16             : {
      17             :         /// <summary>
      18             :         /// A factory for getting connection strings and container names for <see cref="IDataStore{TData}"/> access.
      19             :         /// This factory supports reading and writing from separate storage accounts. Specifically you can have as many different storage accounts as you want to configure when writing.
      20             :         /// This allows for manual mirroring of data while reading from the fastest/closest location possible.
      21             :         /// </summary>
      22             :         public class TableStorageDataStoreConnectionStringFactory<TData> : TableStorageDataStoreConnectionStringFactory
      23           1 :         {
      24             :                 /// <summary>
      25             :                 /// Instantiates a new instance of <see cref="TableStorageDataStoreConnectionStringFactory{TData}"/>.
      26             :                 /// </summary>
      27           1 :                 public TableStorageDataStoreConnectionStringFactory(IConfigurationManager configurationManager, ILogger logger)
      28             :                         : base(configurationManager, logger)
      29             :                 {
      30             :                 }
      31             : 
      32             :                 #region Overrides of TableStorageDataStoreConnectionStringFactory
      33             : 
      34             :                 /// <summary>
      35             :                 /// Returns <see cref="GetTableName{TData1}"/>.
      36             :                 /// </summary>
      37             :                 /// <returns><see cref="GetTableName{TData1}"/></returns>
      38           1 :                 public override string GetContainerName()
      39             :                 {
      40             :                         return GetTableName<TData>();
      41             :                 }
      42             : 
      43             :                 /// <summary>
      44             :                 /// Generates the name of the table for <typeparamref name="TData1"/> that matches naming rules for Azure Storage.
      45             :                 /// The value differs from <see cref="TableStorageDataStoreConnectionStringFactory.GetTableName{TData}"/> in that it appends "V2" to the end of the table name.
      46             :                 /// </summary>
      47             :                 /// <typeparam name="TData1">The <see cref="Type"/> of data to read or write.</typeparam>
      48             :                 /// <remarks>https://blogs.msdn.microsoft.com/jmstall/2014/06/12/azure-storage-naming-rules/</remarks>
      49           1 :                 public override string GetTableName<TData1>()
      50             :                 {
      51             :                         string tableName = base.GetTableName<TData>();
      52             :                         if (tableName.Length > 34)
      53             :                                 tableName = tableName.Substring(tableName.Length - 34);
      54             :                         return string.Format("{0}V2", tableName);
      55             :                 }
      56             : 
      57             :                 #endregion
      58             :         }
      59             : }

Generated by: LCOV version 1.12