From 9b5ea5418701f1596b0d4d5ed6c4d6f0d9777a6e Mon Sep 17 00:00:00 2001 From: Massimiliano Donini Date: Thu, 25 Aug 2022 15:15:32 +0200 Subject: [PATCH] PR feedback --- AutoNumber/AutoNumber.csproj | 8 ++++---- AutoNumber/BlobOptimisticDataStore.cs | 3 --- AutoNumber/Options/AutoNumberOptionsBuilder.cs | 2 +- README.md | 8 ++++---- 4 files changed, 9 insertions(+), 12 deletions(-) diff --git a/AutoNumber/AutoNumber.csproj b/AutoNumber/AutoNumber.csproj index 06b9e9b..83626b7 100644 --- a/AutoNumber/AutoNumber.csproj +++ b/AutoNumber/AutoNumber.csproj @@ -6,9 +6,9 @@ SnowMaker AzureAutoNumber High performance, distributed unique id generator for Azure environments. - 1.3.3 - 1.3.3.0 - 1.3.3.0 + 1.4.0 + 1.4.0.0 + 1.4.0.0 bin\$(Configuration)\ Ali Bahraminezhad MS-PL @@ -20,7 +20,7 @@ true Upgrade packages and add support for .NET6 AzureAutoNumber - 1.3.3 + 1.4.0 False diff --git a/AutoNumber/BlobOptimisticDataStore.cs b/AutoNumber/BlobOptimisticDataStore.cs index 5296c50..f0e5f1e 100644 --- a/AutoNumber/BlobOptimisticDataStore.cs +++ b/AutoNumber/BlobOptimisticDataStore.cs @@ -150,9 +150,6 @@ private BlockBlobClient InitializeBlobReference(string blockName) private async Task UploadTextAsync(BlockBlobClient blob, string text, BlobRequestConditions accessCondition) { - //blob.Properties.ContentType = "utf-8"; - //blob.Properties.ContentType = "text/plain"; - var header = new BlobHttpHeaders { ContentType = "text/plain" diff --git a/AutoNumber/Options/AutoNumberOptionsBuilder.cs b/AutoNumber/Options/AutoNumberOptionsBuilder.cs index 9582c7e..9dce0e7 100644 --- a/AutoNumber/Options/AutoNumberOptionsBuilder.cs +++ b/AutoNumber/Options/AutoNumberOptionsBuilder.cs @@ -42,7 +42,7 @@ public AutoNumberOptionsBuilder UseStorageAccount(string connectionStringOrName) return this; } - public AutoNumberOptionsBuilder UseStorageAccount(BlobServiceClient blobServiceClient) + public AutoNumberOptionsBuilder UseBlobServiceClient(BlobServiceClient blobServiceClient) { Options.BlobServiceClient = blobServiceClient ?? throw new ArgumentNullException(nameof(blobServiceClient)); diff --git a/README.md b/README.md index d4fb400..7048407 100644 --- a/README.md +++ b/README.md @@ -16,9 +16,9 @@ The project is rely on Azure Blob Storage. `AutoNumber` package will generate id ``` -var blobStorageAccount = Microsoft.WindowsAzure.Storage.CloudStorageAccount.Parse(connectionString); +var blobServiceClient = new BlobServiceClient(connectionString); -var blobOptimisticDataStore = new BlobOptimisticDataStore(blobStorageAccount, "unique-ids"); +var blobOptimisticDataStore = new BlobOptimisticDataStore(blobServiceClient, "unique-ids"); var idGen = new UniqueIdGenerator(blobOptimisticDataStore); @@ -29,7 +29,7 @@ var id2 = idGen.NextId("orders"); ``` ### With Microsoft DI -The project has an extension method to add it and its dependencies to Microsoft ASP.NET DI. ~~The only caveat is you need to registry type of `CloudStorageAccount` in DI before registring `AutoNumber`.~~ +The project has an extension method to add it and its dependencies to Microsoft ASP.NET DI. ~~The only caveat is you need to registry type of `BlobServiceClient` in DI before registring `AutoNumber`.~~ Use options builder to configure the service, take into account the default settings will read from `appsettings.json`. @@ -39,7 +39,7 @@ services.AddAutoNumber(Configuration, x => { return x.UseContainerName("container-name") .UseStorageAccount("connection-string-or-connection-string-name") - //.UseStorageAccount(cloudStorageAccountInstance) + //.UseBlobServiceClient(blobServiceClient) .SetBatchSize(10) .SetMaxWriteAttempts(100) .Options;