Class SequentialValueStore
SQL Server implementation of sequential value generation for auto-incrementing counters.
Implements
Inherited Members
Namespace: DataWeb.Data.SqlServer
Assembly: DataWeb.Data.SqlServer.dll
Syntax
public class SequentialValueStore : ISequentialValueStore
Constructors
SequentialValueStore(ISqlHelper)
SQL Server implementation of sequential value generation for auto-incrementing counters.
Declaration
public SequentialValueStore(ISqlHelper sqlHelper)
Parameters
| Type | Name | Description |
|---|---|---|
| ISqlHelper | sqlHelper |
Properties
Name
Gets the name of the sequential value store provider.
Declaration
public string Name { get; }
Property Value
| Type | Description |
|---|---|
| string |
Methods
GetNewValueAsync(string, CancellationToken)
Increments and returns the next sequential value for a given counter name.
Declaration
public Task<int> GetNewValueAsync(string name, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| string | name | The name of the sequential counter. |
| CancellationToken | cancellationToken | The cancellation token. |
Returns
| Type | Description |
|---|---|
| Task<int> | The new incremented value. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentException | Thrown when |
| InvalidOperationException | Thrown when the sequential value name is not found in the database. |
SeedValueAsync(string, CancellationToken)
Seeds a sequential counter with an initial value.
Declaration
public Task SeedValueAsync(string name, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| string | name | The name of the sequential counter to seed. |
| CancellationToken | cancellationToken | The cancellation token. |
Returns
| Type | Description |
|---|---|
| Task |
Exceptions
| Type | Condition |
|---|---|
| ArgumentException | Thrown when |