Class Sequence
Utility functions for getting primary keys. Keys are "burned" permanently and cannot be re-used. Key reservation is a potential bottleneck, so if you know in advance how many keys you will need, you should reserve them in one call.
Inherited Members
Namespace: SuperOffice.Data
Assembly: SoDataBase.dll
Syntax
public static class Sequence
Methods
GetNext(SoTable)
Get the next primary key for a table given the definition of a table
Declaration
public static int GetNext(SoTable soTable)
Parameters
| Type | Name | Description |
|---|---|---|
| SoTable | soTable | Defininition of the table from the runtime dictionary |
Returns
| Type | Description |
|---|---|
| int | New (e.g. next) primary key value, given information about a table table. |
GetNext(SoTable, int)
Get the next primary key range for a table given the definition of a table
Declaration
public static int GetNext(SoTable soTable, int count)
Parameters
| Type | Name | Description |
|---|---|---|
| SoTable | soTable | Defininition of the table from the runtime dictionary |
| int | count | Number of records to reserve keys for |
Returns
| Type | Description |
|---|---|
| int | The first new key of the desired range |
GetNext(TableInfo)
Get the next primary key for a given table .
Declaration
public static int GetNext(TableInfo tableInfo)
Parameters
| Type | Name | Description |
|---|---|---|
| TableInfo | tableInfo | TableInfo object representing the table. |
Returns
| Type | Description |
|---|---|
| int | New (e.g. next) primary key value |
GetNext(TableInfo, int)
Get the next primary key range for a given table .
Declaration
public static int GetNext(TableInfo tableInfo, int count)
Parameters
| Type | Name | Description |
|---|---|---|
| TableInfo | tableInfo | TableInfo object representing the table. |
| int | count | Number of records to reserve keys for |
Returns
| Type | Description |
|---|---|
| int | The first new key of the desired range |
GetNext(int, int)
Reserve a set of new id's from the sequence table, given the tables sequence number.
Declaration
[Obsolete("Please use an overload taking TableInfo or SoTable; not all tables have a sequence number! - the overloads will handle those as well.", false)]
public static int GetNext(int sequenceID, int count)
Parameters
| Type | Name | Description |
|---|---|---|
| int | sequenceID | Sequence id of the table. |
| int | count | Number of new sequence id's to reserve |
Returns
| Type | Description |
|---|---|
| int | First id of the range. |
GetNextAsync(SoTable, int, CancellationToken)
Get the next primary key range for a table given the definition of a table
Declaration
[CreateSyncVersion(OmitNullableDirective = true)]
public static Task<int> GetNextAsync(SoTable soTable, int count, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| SoTable | soTable | Defininition of the table from the runtime dictionary |
| int | count | Number of records to reserve keys for |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task<int> | The first new key of the desired range |
GetNextAsync(SoTable, CancellationToken)
Get the next primary key for a table given the definition of a table
Declaration
[CreateSyncVersion(OmitNullableDirective = true)]
public static Task<int> GetNextAsync(SoTable soTable, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| SoTable | soTable | Defininition of the table from the runtime dictionary |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task<int> | New (e.g. next) primary key value, given information about a table table. |
GetNextAsync(TableInfo, int, CancellationToken)
Get the next primary key range for a given table .
Declaration
[CreateSyncVersion(OmitNullableDirective = true)]
public static Task<int> GetNextAsync(TableInfo tableInfo, int count, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| TableInfo | tableInfo | TableInfo object representing the table. |
| int | count | Number of records to reserve keys for |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task<int> | The first new key of the desired range |
GetNextAsync(TableInfo, CancellationToken)
Get the next primary key for a given table .
Declaration
[CreateSyncVersion(OmitNullableDirective = true)]
public static Task<int> GetNextAsync(TableInfo tableInfo, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| TableInfo | tableInfo | TableInfo object representing the table. |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task<int> | New (e.g. next) primary key value |
GetNextBatch(PKContainer)
Collect several new primary keys for new row objects held by the PKContainer.
Declaration
public static void GetNextBatch(PKContainer pkContainer)
Parameters
| Type | Name | Description |
|---|---|---|
| PKContainer | pkContainer | Object holding information about inserts in need of next sequence id's |
GetNextBatchAsync(PKContainer, CancellationToken)
Collect several new primary keys for new row objects held by the PKContainer.
Declaration
[CreateSyncVersion(OmitNullableDirective = true)]
public static Task GetNextBatchAsync(PKContainer pkContainer, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| PKContainer | pkContainer | Object holding information about inserts in need of next sequence id's |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task |