Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose select query option on GetEntity #15161

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions sdk/tables/Azure.Data.Tables/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

## 3.0.0-beta.2 (Unreleased)

### Changed

- `TableClient`'s `GetEntity` method now exposes the `select` query option to allow for more efficient existence checks for a table entity

## 3.0.0-beta.1 (2020-09-08)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ public TableClient(System.Uri endpoint, string tableName, Azure.Data.Tables.Tabl
public virtual System.Threading.Tasks.Task<Azure.Response> DeleteEntityAsync(string partitionKey, string rowKey, Azure.ETag ifMatch = default(Azure.ETag), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public virtual Azure.Response<System.Collections.Generic.IReadOnlyList<Azure.Data.Tables.Models.SignedIdentifier>> GetAccessPolicy(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public virtual System.Threading.Tasks.Task<Azure.Response<System.Collections.Generic.IReadOnlyList<Azure.Data.Tables.Models.SignedIdentifier>>> GetAccessPolicyAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public virtual System.Threading.Tasks.Task<Azure.Response<T>> GetEntityAsync<T>(string partitionKey, string rowKey, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) where T : class, Azure.Data.Tables.ITableEntity, new() { throw null; }
public virtual Azure.Response<T> GetEntity<T>(string partitionKey, string rowKey, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) where T : class, Azure.Data.Tables.ITableEntity, new() { throw null; }
public virtual System.Threading.Tasks.Task<Azure.Response<T>> GetEntityAsync<T>(string partitionKey, string rowKey, System.Collections.Generic.IEnumerable<string> select = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) where T : class, Azure.Data.Tables.ITableEntity, new() { throw null; }
public virtual Azure.Response<T> GetEntity<T>(string partitionKey, string rowKey, System.Collections.Generic.IEnumerable<string> select = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) where T : class, Azure.Data.Tables.ITableEntity, new() { throw null; }
public virtual Azure.Data.Tables.Sas.TableSasBuilder GetSasBuilder(Azure.Data.Tables.Sas.TableSasPermissions permissions, System.DateTimeOffset expiresOn) { throw null; }
public virtual Azure.Data.Tables.Sas.TableSasBuilder GetSasBuilder(string rawPermissions, System.DateTimeOffset expiresOn) { throw null; }
public virtual Azure.AsyncPageable<T> QueryAsync<T>(System.Linq.Expressions.Expression<System.Func<T, bool>> filter, int? maxPerPage = default(int?), System.Collections.Generic.IEnumerable<string> select = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) where T : class, Azure.Data.Tables.ITableEntity, new() { throw null; }
Expand Down
14 changes: 10 additions & 4 deletions sdk/tables/Azure.Data.Tables/src/TableClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -408,15 +408,18 @@ public virtual async Task<Response> DeleteAsync(CancellationToken cancellationTo
/// </summary>
/// <param name="partitionKey">The partitionKey that identifies the table entity.</param>
/// <param name="rowKey">The rowKey that identifies the table entity.</param>
/// <param name="select">Selects which set of entity properties to return in the result set.</param>
/// <param name="cancellationToken">A <see cref="CancellationToken"/> controlling the request lifetime.</param>
/// <returns>The <see cref="Response"/> indicating the result of the operation.</returns>
/// <exception cref="RequestFailedException">Exception thrown if the entity doesn't exist.</exception>
/// <exception cref="ArgumentNullException"><paramref name="partitionKey"/> or <paramref name="rowKey"/> is null.</exception>
public virtual Response<T> GetEntity<T>(string partitionKey, string rowKey, CancellationToken cancellationToken = default) where T : class, ITableEntity, new()
public virtual Response<T> GetEntity<T>(string partitionKey, string rowKey, IEnumerable<string> select = null, CancellationToken cancellationToken = default) where T : class, ITableEntity, new()
{
Argument.AssertNotNull("message", nameof(partitionKey));
Argument.AssertNotNull("message", nameof(rowKey));

string selectArg = select == null ? null : string.Join(",", select);

using DiagnosticScope scope = _diagnostics.CreateScope($"{nameof(TableClient)}.{nameof(GetEntity)}");
scope.Start();
try
Expand All @@ -425,7 +428,7 @@ public virtual async Task<Response> DeleteAsync(CancellationToken cancellationTo
_table,
partitionKey,
rowKey,
queryOptions: new QueryOptions() { Format = _format },
queryOptions: new QueryOptions() { Format = _format, Select = selectArg },
cancellationToken: cancellationToken);

var result = ((Dictionary<string, object>)response.Value).ToTableEntity<T>();
Expand All @@ -443,15 +446,18 @@ public virtual async Task<Response> DeleteAsync(CancellationToken cancellationTo
/// </summary>
/// <param name="partitionKey">The partitionKey that identifies the table entity.</param>
/// <param name="rowKey">The rowKey that identifies the table entity.</param>
/// <param name="select">Selects which set of entity properties to return in the result set.</param>
/// <param name="cancellationToken">A <see cref="CancellationToken"/> controlling the request lifetime.</param>
/// <returns>The <see cref="Response"/> indicating the result of the operation.</returns>
/// <exception cref="RequestFailedException">Exception thrown if the entity doesn't exist.</exception>
/// <exception cref="ArgumentNullException"><paramref name="partitionKey"/> or <paramref name="rowKey"/> is null.</exception>
public virtual async Task<Response<T>> GetEntityAsync<T>(string partitionKey, string rowKey, CancellationToken cancellationToken = default) where T : class, ITableEntity, new()
public virtual async Task<Response<T>> GetEntityAsync<T>(string partitionKey, string rowKey, IEnumerable<string> select = null, CancellationToken cancellationToken = default) where T : class, ITableEntity, new()
{
Argument.AssertNotNull("message", nameof(partitionKey));
Argument.AssertNotNull("message", nameof(rowKey));

string selectArg = select == null ? null : string.Join(",", select);

using DiagnosticScope scope = _diagnostics.CreateScope($"{nameof(TableClient)}.{nameof(GetEntity)}");
scope.Start();
try
Expand All @@ -460,7 +466,7 @@ public virtual async Task<Response> DeleteAsync(CancellationToken cancellationTo
_table,
partitionKey,
rowKey,
queryOptions: new QueryOptions() { Format = _format },
queryOptions: new QueryOptions() { Format = _format, Select = selectArg },
cancellationToken: cancellationToken).ConfigureAwait(false);

var result = ((Dictionary<string, object>)response.Value).ToTableEntity<T>();
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading