AzureAutoNumber 1.2.1
See the version list below for details.
dotnet add package AzureAutoNumber --version 1.2.1
NuGet\Install-Package AzureAutoNumber -Version 1.2.1
<PackageReference Include="AzureAutoNumber" Version="1.2.1" />
paket add AzureAutoNumber --version 1.2.1
#r "nuget: AzureAutoNumber, 1.2.1"
// Install AzureAutoNumber as a Cake Addin #addin nuget:?package=AzureAutoNumber&version=1.2.1 // Install AzureAutoNumber as a Cake Tool #tool nuget:?package=AzureAutoNumber&version=1.2.1
How to use
The project relies on Azure Blob Storage. AutoNumber
package will generate ids by using a single text file on the Azure Blob Storage.
var blobStorageAccount = Microsoft.WindowsAzure.Storage.CloudStorageAccount.Parse(connectionString);
var blobOptimisticDataStore = new BlobOptimisticDataStore(blobStorageAccount, "unique-ids");
var idGen = new UniqueIdGenerator(blobOptimisticDataStore);
// generate ids with different scopes
var id = idGen.NextId("urls");
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
.
Use options builder to configure the service, take into account the default settings will read from appsettings.json
.
services.AddAutoNumber(Configuration, x =>
{
return x.UseContainerName("container-name")
.UseStorageAccount("connection-string-or-connection-string-name")
//.UseStorageAccount(cloudStorageAccountInstance)
.SetBatchSize(10)
.SetMaxWriteAttempts(100)
.Options;
});
Deprecated way to register the service:
// configure the services
// you need to register an instane of CloudStorageAccount before using this
serviceCollection.AddAutoNumber();
Inject IUniqueIdGenerator
in constructor
public class Foo
{
public Foo(IUniqueIdGenerator idGenerator)
{
_idGenerator = idGenerator;
}
}
Configuration
These are default configuration for AutoNumber
. If you prefer registering AutoNumber with AddAddNumber
method, these options can be set via appsettings.json
.
{
"AutoNumber": {
"BatchSize": 50,
"MaxWriteAttempts": 25,
"StorageContainerName": "unique-urls"
}
}
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 is compatible. netcoreapp3.1 is compatible. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 is compatible. |
.NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETCoreApp 3.0
- Azure.Storage.Blobs (>= 12.4.4)
- Microsoft.Azure.KeyVault.Core (>= 3.0.5)
- Microsoft.Azure.Storage.Blob (>= 11.1.7)
- Microsoft.Data.Services.Client (>= 5.8.4)
- Microsoft.Extensions.Configuration (>= 3.1.5)
- Microsoft.Extensions.Configuration.Abstractions (>= 3.1.5)
- Microsoft.Extensions.Configuration.Binder (>= 3.1.5)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 3.1.5)
- Microsoft.Extensions.Options (>= 3.1.5)
- Microsoft.Rest.ClientRuntime (>= 2.3.21)
- Microsoft.Rest.ClientRuntime.Azure (>= 3.3.19)
- Newtonsoft.Json (>= 12.0.3)
- System.Data.DataSetExtensions (>= 4.5.0)
- System.Threading (>= 4.3.0)
- System.Threading.Tasks (>= 4.3.0)
- System.Threading.Tasks.Extensions (>= 4.5.4)
-
.NETCoreApp 3.1
- Azure.Storage.Blobs (>= 12.4.4)
- Microsoft.Azure.KeyVault.Core (>= 3.0.5)
- Microsoft.Azure.Storage.Blob (>= 11.1.7)
- Microsoft.Data.Services.Client (>= 5.8.4)
- Microsoft.Extensions.Configuration (>= 3.1.5)
- Microsoft.Extensions.Configuration.Abstractions (>= 3.1.5)
- Microsoft.Extensions.Configuration.Binder (>= 3.1.5)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 3.1.5)
- Microsoft.Extensions.Options (>= 3.1.5)
- Microsoft.Rest.ClientRuntime (>= 2.3.21)
- Microsoft.Rest.ClientRuntime.Azure (>= 3.3.19)
- Newtonsoft.Json (>= 12.0.3)
- System.Data.DataSetExtensions (>= 4.5.0)
- System.Threading (>= 4.3.0)
- System.Threading.Tasks (>= 4.3.0)
- System.Threading.Tasks.Extensions (>= 4.5.4)
-
.NETStandard 2.0
- Azure.Storage.Blobs (>= 12.4.4)
- Microsoft.Azure.KeyVault.Core (>= 3.0.5)
- Microsoft.Azure.Storage.Blob (>= 11.1.7)
- Microsoft.Data.Services.Client (>= 5.8.4)
- Microsoft.Extensions.Configuration (>= 3.1.5)
- Microsoft.Extensions.Configuration.Abstractions (>= 3.1.5)
- Microsoft.Extensions.Configuration.Binder (>= 3.1.5)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 3.1.5)
- Microsoft.Extensions.Options (>= 3.1.5)
- Microsoft.Rest.ClientRuntime (>= 2.3.21)
- Microsoft.Rest.ClientRuntime.Azure (>= 3.3.19)
- Newtonsoft.Json (>= 12.0.3)
- System.Data.DataSetExtensions (>= 4.5.0)
- System.Threading (>= 4.3.0)
- System.Threading.Tasks (>= 4.3.0)
- System.Threading.Tasks.Extensions (>= 4.5.4)
-
.NETStandard 2.1
- Azure.Storage.Blobs (>= 12.4.4)
- Microsoft.Azure.KeyVault.Core (>= 3.0.5)
- Microsoft.Azure.Storage.Blob (>= 11.1.7)
- Microsoft.Data.Services.Client (>= 5.8.4)
- Microsoft.Extensions.Configuration (>= 3.1.5)
- Microsoft.Extensions.Configuration.Abstractions (>= 3.1.5)
- Microsoft.Extensions.Configuration.Binder (>= 3.1.5)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 3.1.5)
- Microsoft.Extensions.Options (>= 3.1.5)
- Microsoft.Rest.ClientRuntime (>= 2.3.21)
- Microsoft.Rest.ClientRuntime.Azure (>= 3.3.19)
- Newtonsoft.Json (>= 12.0.3)
- System.Data.DataSetExtensions (>= 4.5.0)
- System.Threading (>= 4.3.0)
- System.Threading.Tasks (>= 4.3.0)
- System.Threading.Tasks.Extensions (>= 4.5.4)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on AzureAutoNumber:
Package | Downloads |
---|---|
ASPOT_API_SharedUtilities
Package Description |
GitHub repositories
This package is not used by any popular GitHub repositories.
Bug fixed:
1. AddAutoNumber extension throws a scoping exception (aspnet core 3.1)
Breacking changes:
1. The AddAutoNumber is deprecated now, use another overload with options builder instead.