VOOZH about

URL: https://www.nuget.org/packages/Iskra.Clients.SequenceGenerator/

⇱ NuGet Gallery | Iskra.Clients.SequenceGenerator 1.0.30




Iskra.Clients.SequenceGenerator 1.0.30

dotnet add package Iskra.Clients.SequenceGenerator --version 1.0.30
 
 
NuGet\Install-Package Iskra.Clients.SequenceGenerator -Version 1.0.30
 
 
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Iskra.Clients.SequenceGenerator" Version="1.0.30" />
 
 
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Iskra.Clients.SequenceGenerator" Version="1.0.30" />
 
Directory.Packages.props
<PackageReference Include="Iskra.Clients.SequenceGenerator" />
 
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Iskra.Clients.SequenceGenerator --version 1.0.30
 
 
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Iskra.Clients.SequenceGenerator, 1.0.30"
 
 
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Iskra.Clients.SequenceGenerator@1.0.30
 
 
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Iskra.Clients.SequenceGenerator&version=1.0.30
 
Install as a Cake Addin
#tool nuget:?package=Iskra.Clients.SequenceGenerator&version=1.0.30
 
Install as a Cake Tool
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

Iskra.Clients.SequenceGenerator

Описание

Пакет Iskra.Clients.SequenceGenerator предоставляет клиентскую библиотеку для работы с генератором последовательностей. Он позволяет создавать, обновлять, удалять и получать счетчики последовательностей, а также получать следующие значения этих счетчиков.

Установка

Установите пакет через NuGet:

dotnet add package Iskra.Clients.SequenceGenerator

Использование

1. Конфигурация

Добавьте пакет в ваш проект и настройте его в Startup.cs или Program.cs вашего приложения.

В Startup.cs:
public void ConfigureServices(IServiceCollection services)
{
 // Добавление генератора последовательностей с фоновым сервисом для проверки существования необходимых счетчиков
 services.AddReoSequenceGeneratorWithCounterNameExistsChecking(Configuration);
}
В Program.cs (для .NET 6 и выше):
public static IHostBuilder CreateHostBuilder(string[] args) =>
 Host.CreateDefaultBuilder(args)
 .ConfigureServices((context, services) =>
 {
 // Добавление генератора последовательностей с фоновым сервисом для проверки существования необходимых счетчиков
 services.AddReoSequenceGeneratorWithCounterNameExistsChecking(context.Configuration);
 });

2. Использование клиента

Внедрите ISequenceGeneratorClient в ваш класс и используйте его методы для работы с счетчиками последовательностей.

public class SequenceService
{
 private readonly ISequenceGeneratorClient _sequenceGeneratorClient;

 public SequenceService(ISequenceGeneratorClient sequenceGeneratorClient)
 {
 _sequenceGeneratorClient = sequenceGeneratorClient;
 }

 public async Task<int> GetNextSequenceValue(string name, CancellationToken token = default)
 {
 var sequence = await _sequenceGeneratorClient.GetNextAsync(name, token);
 return sequence.Value;
 }
}

3. Методы клиента

Получение счетчика последовательности
Task<Sequence> GetAsync(string name, CancellationToken token);
Обновление счетчика последовательности
Task<Sequence> UpdateAsync(string name, int value, CancellationToken token);
Создание счетчика последовательности
Task<Sequence> CreateAsync(string name, CancellationToken token);
Удаление счетчика последовательности
Task<bool> DeleteAsync(string name, CancellationToken token);
Получение списка всех счетчиков последовательностей
Task<IReadOnlyCollection<Sequence>> GetAllAsync(CancellationToken token);
Получение следующего значения счетчика последовательности
Task<Sequence> GetNextAsync(string name, CancellationToken token);
Получение нескольких значений счетчика последовательности
Task<BulkSequence> GetNextBulkAsync(string name, int chunkSize, CancellationToken token);

Примеры

Создание и получение следующего значения счетчика

public async Task<int> CreateAndGetNextValue(string sequenceName)
{
 // Создаем счетчик последовательности
 await _sequenceGeneratorClient.CreateAsync(sequenceName);

 // Получаем следующее значение счетчика
 var nextSequence = await _sequenceGeneratorClient.GetNextAsync(sequenceName);
 return nextSequence.Value;
}

Обновление и получение следующего значения счетчика

public async Task<int> UpdateAndGetNextValue(string sequenceName, int newValue)
{
 // Обновляем значение счетчика
 await _sequenceGeneratorClient.UpdateAsync(sequenceName, newValue);

 // Получаем следующее значение счетчика
 var nextSequence = await _sequenceGeneratorClient.GetNextAsync(sequenceName);
 return nextSequence.Value;
}
Product Versions Compatible and additional computed target framework versions.
.NET net8.0 net8.0 is compatible.  net8.0-android net8.0-android was computed.  net8.0-browser net8.0-browser was computed.  net8.0-ios net8.0-ios was computed.  net8.0-maccatalyst net8.0-maccatalyst was computed.  net8.0-macos net8.0-macos was computed.  net8.0-tvos net8.0-tvos was computed.  net8.0-windows net8.0-windows was computed.  net9.0 net9.0 was computed.  net9.0-android net9.0-android was computed.  net9.0-browser net9.0-browser was computed.  net9.0-ios net9.0-ios was computed.  net9.0-maccatalyst net9.0-maccatalyst was computed.  net9.0-macos net9.0-macos was computed.  net9.0-tvos net9.0-tvos was computed.  net9.0-windows net9.0-windows was computed.  net10.0 net10.0 was computed.  net10.0-android net10.0-android was computed.  net10.0-browser net10.0-browser was computed.  net10.0-ios net10.0-ios was computed.  net10.0-maccatalyst net10.0-maccatalyst was computed.  net10.0-macos net10.0-macos was computed.  net10.0-tvos net10.0-tvos was computed.  net10.0-windows net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.30 239 5/22/2025
1.0.29 202 5/22/2025
1.0.28 228 5/20/2025
1.0.27 232 5/20/2025
1.0.26 217 5/19/2025
1.0.25 308 5/14/2025
1.0.24 298 5/13/2025
1.0.23 311 5/12/2025
1.0.22 236 5/7/2025
1.0.21 221 5/7/2025
1.0.20 222 5/7/2025
1.0.19 228 4/29/2025
1.0.18 230 4/29/2025
1.0.17 205 4/28/2025
1.0.16 254 4/22/2025
1.0.15 215 4/22/2025
1.0.14 225 4/21/2025
1.0.13 247 4/21/2025
1.0.12 250 4/16/2025
1.0.11 272 4/16/2025
Loading failed