Class CachedSequence
This class is used to get sequence numbers (primary keys) for tables, where the physical sequence table is updated in batches.
Inherited Members
Namespace: SuperOffice.Data
Assembly: SoDataBase.dll
Syntax
[SoInject("Database")]
public class CachedSequence
Remarks
Picking from sequence one-by-one is the default and usually correct approach, since it (almost) guarantees a chronological order in the target table, and no holes. However, there are cases where, for performance reasons, it is better to "burn" an interval. This is kept in-memory and then given out. If the process recycles or another process does the same, holes may result; and the target table id's may not be in chronological order.
Methods
Flush()
Reset all the cached sequences. Start over.
Declaration
public void Flush()
Remarks
Picking from sequence one-by-one is the default and usually correct approach, since it (almost) guarantees a chronological order in the target table, and no holes. However, there are cases where, for performance reasons, it is better to "burn" an interval. This is kept in-memory and then given out. If the process recycles or another process does the same, holes may result; and the target table id's may not be in chronological order.
Flush(string)
Reset a single table from the cache.
Declaration
public void Flush(string tableName)
Parameters
| Type | Name | Description |
|---|---|---|
| string | tableName |
Remarks
Picking from sequence one-by-one is the default and usually correct approach, since it (almost) guarantees a chronological order in the target table, and no holes. However, there are cases where, for performance reasons, it is better to "burn" an interval. This is kept in-memory and then given out. If the process recycles or another process does the same, holes may result; and the target table id's may not be in chronological order.
GetNextAsync(string, int, CancellationToken)
This class is used to get sequence numbers (primary keys) for tables, where the physical sequence table is updated in batches.
Declaration
public Task<int> GetNextAsync(string tableName, int physicalBatchSize = 100, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| string | tableName | |
| int | physicalBatchSize | |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task<int> |
Remarks
Picking from sequence one-by-one is the default and usually correct approach, since it (almost) guarantees a chronological order in the target table, and no holes. However, there are cases where, for performance reasons, it is better to "burn" an interval. This is kept in-memory and then given out. If the process recycles or another process does the same, holes may result; and the target table id's may not be in chronological order.
ToString()
This class is used to get sequence numbers (primary keys) for tables, where the physical sequence table is updated in batches.
Declaration
public override string ToString()
Returns
| Type | Description |
|---|---|
| string |
Overrides
Remarks
Picking from sequence one-by-one is the default and usually correct approach, since it (almost) guarantees a chronological order in the target table, and no holes. However, there are cases where, for performance reasons, it is better to "burn" an interval. This is kept in-memory and then given out. If the process recycles or another process does the same, holes may result; and the target table id's may not be in chronological order.