Skip to content

Commit

Permalink
Merge pull request #47 from Evodim/features/tableClient-add-deletebyI…
Browse files Browse the repository at this point in the history
…d-operation

PR TableClient : add new deletebyId operation
  • Loading branch information
medevod authored Apr 12, 2023
2 parents ef77bb4 + bc823c2 commit c259d32
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
10 changes: 10 additions & 0 deletions src/Azure.EntityServices.Tables/EntityTableClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -523,5 +523,15 @@ public Task DeleteManyAsync(IEnumerable<T> entities, CancellationToken cancellat
{
return ApplyBatchOperations(EntityOperation.Delete, entities, cancellationToken);
}

public async Task DeleteByIdAsync(string partition, object id, CancellationToken cancellationToken = default)
{
var entity = await GetByIdAsync(partition,id, cancellationToken);
if (entity != null)
{
await DeleteAsync(entity, cancellationToken);
}

}
}
}
4 changes: 3 additions & 1 deletion src/Azure.EntityServices.Tables/IEntityTableClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@ public interface IEntityTableClient<T> : IEntityTableClientRuntimeConfig<T>
IAsyncEnumerable<IEnumerable<T>> GetAsync(Action<IQuery<T>> filter = default, CancellationToken cancellationToken = default);

Task<EntityPage<T>> GetPagedAsync(Action<IQuery<T>> filter = default, int? maxPerPage = null, string nextPageToken = null, CancellationToken cancellationToken = default);


Task DeleteByIdAsync(string partition, object id, CancellationToken cancellationToken = default);

Task DeleteAsync(T entity, CancellationToken cancellationToken = default);

Task DeleteManyAsync(IEnumerable<T> entities, CancellationToken cancellationToken = default);
Expand Down

0 comments on commit c259d32

Please sign in to comment.