diff --git a/Olive.Blob.Azure/AzureBlobStorageProvider.cs b/Olive.Blob.Azure/AzureBlobStorageProvider.cs index 02cef585..3c5affaf 100644 --- a/Olive.Blob.Azure/AzureBlobStorageProvider.cs +++ b/Olive.Blob.Azure/AzureBlobStorageProvider.cs @@ -161,6 +161,24 @@ public async Task DeleteAsync(Blob document) } } + public async Task DeleteAsync(Blob document, string key) + { + if (document.IsEmpty()) return; + + var blobContainer = await GetBlobContainer(); + key = key.Or(document.GetKey()); + + try + { + await blobContainer.DeleteBlobAsync(document.GetKey()); + } + catch (Exception ex) + { + Log.Error(ex, $"Failed to delete document with {key} key on Azure"); + throw; + } + } + public byte[] ToByte(Stream input) { using (MemoryStream ms = new MemoryStream()) diff --git a/Olive.Blob.Azure/Olive.Blob.Azure.csproj b/Olive.Blob.Azure/Olive.Blob.Azure.csproj index 1fa335c2..bf3a17d1 100644 --- a/Olive.Blob.Azure/Olive.Blob.Azure.csproj +++ b/Olive.Blob.Azure/Olive.Blob.Azure.csproj @@ -1,7 +1,7 @@  netcoreapp3.1 - 3.1.118 + 3.1.119