src/TableAccess.cs
/// <summary>
/// Get a single entity based on its partition and row keys.
/// </summary>
/// <param name="partitionKey"> the partition key. </param>
/// <param name="rowKey"> the row key. </param>
/// <returns>An entity of type T. </returns>
/// <exception cref="NotFoundException"> Thrown if the entity is not found. </exception>
Get a single entity based on its partition and row keys.
Get a single entity based on its partition and row keys .
public virtual async Task<T> GetSingleAsync(string partitionKey, string rowKey)
        {
            this.logger?.LogTrace($"Supplied partition key {partitionKey}, supplied row key {rowKey}.");
            if (string.IsNullOrWhiteSpace(partitionKey) || string.IsNullOrWhiteSpace(rowKey))
            {
                throw new NotFoundException(partitionKey, rowKey);
            }
            await this.CreateIfNotExists();
            this.logger?.LogTrace($"Retrieving from table with Partition Key {partitionKey} and row key {rowKey}.");
            TableOperation retrieveOperation = TableOperation.Retrieve<T>(partitionKey, rowKey);
            TableResult retrievedResult = await this.CloudTable.ExecuteAsync(retrieveOperation);
            this.logger?.LogTrace($"TableResult result is not null - {retrievedResult.Result != null}");
            if (retrievedResult.Result != null)
            {
                return (T)retrievedResult.Result;
            }
            throw new NotFoundException(partitionKey, rowKey);
        }
public virtual async Task < T > GetSingleAsync ( string partitionKey , string rowKey ) { this . logger ? . LogTrace ( $" Supplied partition key  { partitionKey } , supplied row key  { rowKey } . " ) ; if ( string . IsNullOrWhiteSpace ( partitionKey ) || string . IsNullOrWhiteSpace ( rowKey ) ) { throw new NotFoundException ( partitionKey , rowKey ) ; } await this . CreateIfNotExists ( ) ; this . logger ? . LogTrace ( $" Retrieving from table with Partition Key  { partitionKey }  and row key  { rowKey } . " ) ; TableOperation retrieveOperation = TableOperation . Retrieve < T > ( partitionKey , rowKey ) ; TableResult retrievedResult = await this . CloudTable . ExecuteAsync ( retrieveOperation ) ; this . logger ? . LogTrace ( $" TableResult result is not null -  { retrievedResult . Result != null } " ) ; if ( retrievedResult . Result != null ) { return ( T ) retrievedResult . Result ; } throw new NotFoundException ( partitionKey , rowKey ) ; }
Get a single entity based on its partition and row keys.
Get a single entity based on its partition and row keys .
An entity of type T.
An entity of type T .
Thrown if the entity is not found.
Thrown if the entity is not found .
partitionKey
string
the partition key.
the partition key .
rowKey
string
the row key.
the row key .