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.
GetNext(string, int)
This class is used to get sequence numbers (primary keys) for tables, where the physical sequence table is updated in batches.
Declaration
public int GetNext(string tableName, int physicalBatchSize = 100)
Parameters
Type | Name | Description |
---|---|---|
string | tableName | |
int | physicalBatchSize |
Returns
Type | Description |
---|---|
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.