Class TableStorageDataStoreConnectionStringFactory
A factory for getting connection strings and container names for IDataStore<TData> access. 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. This allows for manual mirroring of data while reading from the fastest/closest location possible.
Inheritance
Inherited Members
Namespace: Cqrs.Azure.BlobStorage.DataStores
Assembly: Cqrs.Azure.BlobStorage.dll
Syntax
public class TableStorageDataStoreConnectionStringFactory : ITableStorageDataStoreConnectionStringFactory, ITableStorageStoreConnectionStringFactory, IStorageStoreConnectionStringFactory
Constructors
TableStorageDataStoreConnectionStringFactory(IConfigurationManager, ILogger)
Instantiates a new instance of TableStorageDataStoreConnectionStringFactory.
Declaration
public TableStorageDataStoreConnectionStringFactory(IConfigurationManager configurationManager, ILogger logger)
Parameters
Type | Name | Description |
---|---|---|
IConfigurationManager | configurationManager | |
cdmdotnet.Logging.ILogger | logger |
Fields
TableStorageBaseContainerNameKey
The name of the app setting in IConfigurationManager that will have the base name of the container used.
Declaration
public static string TableStorageBaseContainerNameKey
Field Value
Type | Description |
---|---|
System.String |
TableStorageDataStoreConnectionStringKey
The name of the app setting in IConfigurationManager that will have the connection string if using a single storage account for both reads and writes.
Declaration
public static string TableStorageDataStoreConnectionStringKey
Field Value
Type | Description |
---|---|
System.String |
TableStorageReadableDataStoreConnectionStringKey
The name of the app setting in IConfigurationManager that will have the connection string of the readable storage account if using a separate storage account for reads and writes.
Declaration
public static string TableStorageReadableDataStoreConnectionStringKey
Field Value
Type | Description |
---|---|
System.String |
TableStorageWritableDataStoreConnectionStringKey
The name of the app setting in IConfigurationManager that will have the connection string of the writeable storage account if using a separate storage account for reads and writes. This value gets appended with a ".1", ".2" etc allowing you to write to as many different locations as possible.
Declaration
public static string TableStorageWritableDataStoreConnectionStringKey
Field Value
Type | Description |
---|---|
System.String |
Properties
ConfigurationManager
Gets or sets the IConfigurationManager.
Declaration
protected IConfigurationManager ConfigurationManager { get; }
Property Value
Type | Description |
---|---|
IConfigurationManager |
Logger
Gets or sets the cdmdotnet.Logging.ILogger.
Declaration
protected ILogger Logger { get; }
Property Value
Type | Description |
---|---|
cdmdotnet.Logging.ILogger |
Methods
GetBaseContainerName()
Returns the name of the base contain to be used. This will be the value from ConfigurationManager keyed TableStorageBaseContainerNameKey.
Declaration
public string GetBaseContainerName()
Returns
Type | Description |
---|---|
System.String |
Implements
GetContainerName()
Returns GetBaseContainerName().
Declaration
public virtual string GetContainerName()
Returns
Type | Description |
---|---|
System.String | GetBaseContainerName() |
GetReadableConnectionString()
Gets the readable connection string. If using a single storage account, then TableStorageDataStoreConnectionStringKey will most likely be returned. If a value for TableStorageReadableDataStoreConnectionStringKey is found, that will be returned instead.
Declaration
public virtual string GetReadableConnectionString()
Returns
Type | Description |
---|---|
System.String |
Implements
GetTableName<TData>()
Generates the name of the table for TData
that matches naming rules for Azure Storage.
Declaration
public virtual string GetTableName<TData>()
Returns
Type | Description |
---|---|
System.String |
Type Parameters
Name | Description |
---|---|
TData | The System.Type of data to read or write. |
Implements
Remarks
GetWritableConnectionStrings()
Gets all writeable connection strings. If using a single storage account, then TableStorageDataStoreConnectionStringKey will most likely be returned. If a value for TableStorageWritableDataStoreConnectionStringKey is found, it will append ".1", ".2" etc returning any additionally found connection string values in ConfigurationManager.
Declaration
public virtual IEnumerable<string> GetWritableConnectionStrings()
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<System.String> |