diff --git a/src/Azure.EntityServices.Tables/EntityTableClient.cs b/src/Azure.EntityServices.Tables/EntityTableClient.cs index 7837157..974717c 100644 --- a/src/Azure.EntityServices.Tables/EntityTableClient.cs +++ b/src/Azure.EntityServices.Tables/EntityTableClient.cs @@ -523,5 +523,15 @@ public Task DeleteManyAsync(IEnumerable 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); + } + + } } } \ No newline at end of file diff --git a/src/Azure.EntityServices.Tables/IEntityTableClient.cs b/src/Azure.EntityServices.Tables/IEntityTableClient.cs index 4485ab2..4d0fa7f 100644 --- a/src/Azure.EntityServices.Tables/IEntityTableClient.cs +++ b/src/Azure.EntityServices.Tables/IEntityTableClient.cs @@ -31,7 +31,9 @@ public interface IEntityTableClient : IEntityTableClientRuntimeConfig IAsyncEnumerable> GetAsync(Action> filter = default, CancellationToken cancellationToken = default); Task> GetPagedAsync(Action> 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 entities, CancellationToken cancellationToken = default);