Class TableStorageStore<TData, TCollectionItemData>
A IDataStore<TData> that uses Azure Storage for storage.
Inheritance
Inherited Members
Namespace: Cqrs.Azure.BlobStorage
Assembly: Cqrs.Azure.BlobStorage.dll
Syntax
public abstract class TableStorageStore<TData, TCollectionItemData> : StorageStore<TData, CloudTable>, IEnumerable<TData>, IDataStore<TCollectionItemData>, IOrderedQueryable<TCollectionItemData>, IQueryable<TCollectionItemData>, IEnumerable<TCollectionItemData>, IOrderedQueryable, IQueryable, IEnumerable, IDisposable where TData : TableEntity, new ()
Type Parameters
Name | Description |
---|---|
TData | The System.Type of Microsoft.WindowsAzure.Storage.Table.TableEntity Azure Table Storage will contain. |
TCollectionItemData | The System.Type of IEntity the IDataStore<TData> will contain. |
Constructors
TableStorageStore(ILogger)
Initializes a new instance of the TableStorageStore<TData, TCollectionItemData> class using the specified container.
Declaration
protected TableStorageStore(ILogger logger)
Parameters
Type | Name | Description |
---|---|---|
cdmdotnet.Logging.ILogger | logger |
Properties
Collection
Gets or set the Microsoft.WindowsAzure.Storage.Table.TableQuery.
Declaration
public TableQuery<TData> Collection { get; }
Property Value
Type | Description |
---|---|
Microsoft.WindowsAzure.Storage.Table.TableQuery<TData> |
ElementType
Gets the type of the element(s) that are returned when the expression tree associated with this instance of System.Linq.IQueryable is executed.
Declaration
public override Type ElementType { get; }
Property Value
Type | Description |
---|---|
System.Type | A System.Type that represents the type of the element(s) that are returned when the expression tree associated with this object is executed. |
Overrides
Implements
Expression
Gets the expression tree that is associated with the instance of System.Linq.IQueryable.
Declaration
public override Expression Expression { get; }
Property Value
Type | Description |
---|---|
System.Linq.Expressions.Expression | The System.Linq.Expressions.Expression that is associated with this instance of System.Linq.IQueryable. |
Overrides
Implements
Provider
Gets the query provider that is associated with this data source.
Declaration
public override IQueryProvider Provider { get; }
Property Value
Type | Description |
---|---|
System.Linq.IQueryProvider | The System.Linq.IQueryProvider that is associated with this data source. |
Overrides
Implements
Methods
Add(TData)
Add the provided data
to the data store and persist the change.
Declaration
public override void Add(TData data)
Parameters
Type | Name | Description |
---|---|---|
TData | data |
Overrides
Add(TCollectionItemData)
Add the provided data
to the data store and persist the change.
Declaration
public virtual void Add(TCollectionItemData data)
Parameters
Type | Name | Description |
---|---|---|
TCollectionItemData | data |
Implements
Add(ITableEntity)
Add the provided data
to the data store and persist the change.
Declaration
public virtual void Add(ITableEntity data)
Parameters
Type | Name | Description |
---|---|---|
Microsoft.WindowsAzure.Storage.Table.ITableEntity | data |
Add(IEnumerable<TData>)
Add the provided data
to the data store and persist the change.
Declaration
public override void Add(IEnumerable<TData> data)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<TData> | data |
Overrides
Add(IEnumerable<TCollectionItemData>)
Add the provided data
to the data store and persist the change.
Declaration
public virtual void Add(IEnumerable<TCollectionItemData> data)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<TCollectionItemData> | data |
Implements
Add(IEnumerable<ITableEntity>)
Add the provided data
to the data store and persist the change.
Declaration
public virtual void Add(IEnumerable<ITableEntity> data)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<Microsoft.WindowsAzure.Storage.Table.ITableEntity> | data |
AsyncSaveData<TSaveData, TResult>(TSaveData, Func<TSaveData, CloudTable, TResult>, Func<TSaveData, String>)
Save the provided data
asynchronously.
Declaration
protected virtual void AsyncSaveData<TSaveData, TResult>(TSaveData data, Func<TSaveData, CloudTable, TResult> function, Func<TSaveData, string> customFilenameFunction = null)
Parameters
Type | Name | Description |
---|---|---|
TSaveData | data | |
System.Func<TSaveData, Microsoft.WindowsAzure.Storage.Table.CloudTable, TResult> | function | |
System.Func<TSaveData, System.String> | customFilenameFunction |
Type Parameters
Name | Description |
---|---|
TSaveData | |
TResult |
CreateSource(CloudStorageAccount, String, Boolean)
Creates a Microsoft.WindowsAzure.Storage.Table.CloudTable with the specified name sourceName
if it doesn't already exist.
Declaration
protected override CloudTable CreateSource(CloudStorageAccount storageAccount, string sourceName, bool isPublic = true)
Parameters
Type | Name | Description |
---|---|---|
Microsoft.WindowsAzure.Storage.CloudStorageAccount | storageAccount | The storage account to create the Microsoft.WindowsAzure.Storage.Table.CloudTable is |
System.String | sourceName | The name of the Microsoft.WindowsAzure.Storage.Table.CloudTable. |
System.Boolean | isPublic | Whether or not this Microsoft.WindowsAzure.Storage.Table.CloudTable is publicly accessible. |
Returns
Type | Description |
---|---|
Microsoft.WindowsAzure.Storage.Table.CloudTable |
Overrides
CreateTableEntity(TCollectionItemData)
Creates a new instance of Microsoft.WindowsAzure.Storage.Table.ITableEntity populating it with the provided data
.
Declaration
protected abstract ITableEntity CreateTableEntity(TCollectionItemData data)
Parameters
Type | Name | Description |
---|---|---|
TCollectionItemData | data | The data to store. |
Returns
Type | Description |
---|---|
Microsoft.WindowsAzure.Storage.Table.ITableEntity |
Destroy(TData)
Remove the provided data
(normally by Rsn) from the data store and persist the change.
Declaration
public override void Destroy(TData data)
Parameters
Type | Name | Description |
---|---|---|
TData | data |
Overrides
Destroy(TCollectionItemData)
Remove the provided data
(normally by Rsn) from the data store and persist the change.
Declaration
public virtual void Destroy(TCollectionItemData data)
Parameters
Type | Name | Description |
---|---|---|
TCollectionItemData | data |
Implements
GetByKey()
Retrieves the data from Azure Storage using Collection.
Declaration
public virtual IEnumerable<TData> GetByKey()
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<TData> |
GetByKeyAndRow(Guid)
Retrieves the data from Azure Storage using Collection.
Declaration
public virtual TData GetByKeyAndRow(Guid rsn)
Parameters
Type | Name | Description |
---|---|---|
System.Guid | rsn |
Returns
Type | Description |
---|---|
TData |
GetEnumerator()
Returns an enumerator that iterates through the collection.
Declaration
public override IEnumerator<TData> GetEnumerator()
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerator<TData> | A System.Collections.Generic.IEnumerator<T> that can be used to iterate through the collection. |
Overrides
GetSafeSourceName(String)
Gets the provided sourceName
in a safe to use format.
Declaration
protected override string GetSafeSourceName(string sourceName)
Parameters
Type | Name | Description |
---|---|---|
System.String | sourceName | The name to make safe. |
Returns
Type | Description |
---|---|
System.String |
Overrides
GetUpdatableTableEntity(TData)
Gets a Microsoft.WindowsAzure.Storage.Table.TableOperation for updating.
Declaration
protected abstract TableOperation GetUpdatableTableEntity(TData data)
Parameters
Type | Name | Description |
---|---|---|
TData | data |
Returns
Type | Description |
---|---|
Microsoft.WindowsAzure.Storage.Table.TableOperation |
GetUpdatableTableEntity(TCollectionItemData)
Gets a Microsoft.WindowsAzure.Storage.Table.TableOperation for updating.
Declaration
protected abstract TableOperation GetUpdatableTableEntity(TCollectionItemData data)
Parameters
Type | Name | Description |
---|---|---|
TCollectionItemData | data |
Returns
Type | Description |
---|---|
Microsoft.WindowsAzure.Storage.Table.TableOperation |
Initialise(IStorageStoreConnectionStringFactory)
Initialises the StorageStore<TData, TSource>.
Declaration
protected override void Initialise(IStorageStoreConnectionStringFactory tableStorageDataStoreConnectionStringFactory)
Parameters
Type | Name | Description |
---|---|---|
IStorageStoreConnectionStringFactory | tableStorageDataStoreConnectionStringFactory |
Overrides
Remove(TCollectionItemData)
Will mark the data
as logically (or soft).
Declaration
public abstract void Remove(TCollectionItemData data)
Parameters
Type | Name | Description |
---|---|---|
TCollectionItemData | data |
Implements
RemoveAll()
Remove all contents (normally by use of a truncate operation) from the data store and persist the change.
Declaration
public override void RemoveAll()
Overrides
Implements
ReplaceValues(TableResult, TData)
Extracts Microsoft.WindowsAzure.Storage.Table.TableResult.Result of the provided retrievedResult
If Microsoft.WindowsAzure.Storage.Table.TableResult.Result is a IEventDataTableEntity<TEventData>
then EventData is replaced with data
.
Otherwise Microsoft.WindowsAzure.Storage.Table.TableResult.Result is a IEntityTableEntity<TEntity>
and Entity is replaced with data
.
Declaration
protected virtual ITableEntity ReplaceValues(TableResult retrievedResult, TData data)
Parameters
Type | Name | Description |
---|---|---|
Microsoft.WindowsAzure.Storage.Table.TableResult | retrievedResult | The existing data to update. |
TData | data | The new data to store. |
Returns
Type | Description |
---|---|
Microsoft.WindowsAzure.Storage.Table.ITableEntity |
Update(TData)
Update the provided data
in the data store and persist the change.
Declaration
public override void Update(TData data)
Parameters
Type | Name | Description |
---|---|---|
TData | data |
Overrides
Update(TCollectionItemData)
Update the provided data
in the data store and persist the change.
Declaration
public virtual void Update(TCollectionItemData data)
Parameters
Type | Name | Description |
---|---|---|
TCollectionItemData | data |
Implements
Explicit Interface Implementations
IEnumerable<TCollectionItemData>.GetEnumerator()
Returns an enumerator that iterates through the collection.
Declaration
IEnumerator<TCollectionItemData> IEnumerable<TCollectionItemData>.GetEnumerator()
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerator<TCollectionItemData> | A System.Collections.Generic.IEnumerator<T> that can be used to iterate through the collection. |