Show / Hide Table of Contents

Class CachedSequence

This class is used to get sequence numbers (primary keys) for tables, where the physical sequence table is updated in batches.

Inheritance
object
CachedSequence
Inherited Members
object.Equals(object)
object.Equals(object, object)
object.ReferenceEquals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()
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
object.ToString()
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.

Extension Methods

EnumUtil.MapEnums<From, To>(From)
Converters.MapEnums<From, To>(From)
© SuperOffice. All rights reserved.
SuperOffice |  Community |  Release Notes |  Privacy |  Site feedback |  Search Docs |  About Docs |  Contribute |  Back to top