Interface ITableStorageClient<TElement>
Interface definition to read data from and write data to a Table Storage.
Namespace: Celerik.NetCore.Util
Assembly: cs.temp.dll.dll
Syntax
public interface ITableStorageClient<TElement>
where TElement : ITableEntity, new()
Type Parameters
Name | Description |
---|---|
TElement | The type of table entity. |
Properties
Config
Configuration to access the Table Storage.
Declaration
TableStorageConfig Config { get; }
Property Value
Type | Description |
---|---|
TableStorageConfig |
Methods
AnyAsync(String, String)
Checks if an entity with the passed-in partitionKey and rowKey exists.
Declaration
Task<bool> AnyAsync(string partitionKey, string rowKey)
Parameters
Type | Name | Description |
---|---|---|
System.String | partitionKey | Partitition Key. |
System.String | rowKey | Row Key. |
Returns
Type | Description |
---|---|
Task<System.Boolean> | The task object representing the asynchronous operation. |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | If partitionKey or rowKey are null. |
TableStorageException | If there was an error performing the operation. |
DeleteAsync(TElement)
Deletes an existing entity.
Declaration
Task<TElement> DeleteAsync(TElement entity)
Parameters
Type | Name | Description |
---|---|---|
TElement | entity | The entity to delete. |
Returns
Type | Description |
---|---|
Task<TElement> | The task object representing the asynchronous operation. |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | If entity is null, or entity.PartitionKey is null or entity.RowKey is null. |
TableStorageException | If there was an error performing the operation. |
DeleteAsync(String, String)
Deletes an existing entity.
Declaration
Task<TElement> DeleteAsync(string partitionKey, string rowKey)
Parameters
Type | Name | Description |
---|---|---|
System.String | partitionKey | Partitition Key. |
System.String | rowKey | Row Key. |
Returns
Type | Description |
---|---|
Task<TElement> | The task object representing the asynchronous operation. |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | If partitionKey or rowKey are null. |
TableStorageException | If there was an error performing the operation. |
DeleteIfExistsAsync()
Delete the table specified by the tableName from ITableStorageClient instance based on the passed-in provider.
Declaration
Task<bool> DeleteIfExistsAsync()
Returns
Type | Description |
---|---|
Task<System.Boolean> | The task object representing the asynchronous operation. |
GetAsync(String, String)
Gets an entity by its partitionKey and rowKey. If there is no entity with the passed-in criteria, null is returned.
Declaration
Task<TElement> GetAsync(string partitionKey, string rowKey)
Parameters
Type | Name | Description |
---|---|---|
System.String | partitionKey | Partitition Key. |
System.String | rowKey | Row Key. |
Returns
Type | Description |
---|---|
Task<TElement> | The task object representing the asynchronous operation. |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | If partitionKey or rowKey are null. |
TableStorageException | If there was an error performing the operation. |
InsertAsync(TElement)
Inserts a new entity.
Declaration
Task<TElement> InsertAsync(TElement entity)
Parameters
Type | Name | Description |
---|---|---|
TElement | entity | The entity to insert. |
Returns
Type | Description |
---|---|
Task<TElement> | The task object representing the asynchronous operation. |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | If entity is null. |
PropNullException | If PartitionKey or RowKey are null. |
TableStorageException | If there was an error performing the operation. |
ListAsync(String)
Gets a list of entities matching the given partitionKey. If Partition key is null, all entities will be returned (take into account that it could be a very expensive operation).
Declaration
Task<List<TElement>> ListAsync(string partitionKey = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | partitionKey | Partition Key. |
Returns
Type | Description |
---|---|
Task<System.Collections.Generic.List<TElement>> | The task object representing the asynchronous operation. |
Exceptions
Type | Condition |
---|---|
TableStorageException | If there was an error performing the operation. |
UpdateAsync(TElement, TableStorageStrategy)
Updates an existing entity.
Declaration
Task<TElement> UpdateAsync(TElement entity, TableStorageStrategy strategy = TableStorageStrategy.InsertOrReplace)
Parameters
Type | Name | Description |
---|---|---|
TElement | entity | The entity to update. |
TableStorageStrategy | strategy | Defines the strategy used to update the entity, by default it is set to: InsertOrReplace. |
Returns
Type | Description |
---|---|
Task<TElement> | The task object representing the asynchronous operation. |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | If entity is null. |
PropNullException | If PartitionKey or RowKey are null in the entity object. |
TableStorageException | If there was an error performing the operation. |