Generate Row-Id
Syntax
Arguments
filter
Expression<Func<T, string>>
Column that contains the ID (Primary Key).
This parameter must not be empty.
null
len
int
Total number of characters ID should consist of (including prefix).
8
prefix
string
null
Description
Generates a new ID value for the Primary Key column that is specified in the parameter filter by taking the ID value of the newest record in the repository and incrementing it by 1.
If parameter len is specified, it will additionally add preceding zeroes until the number of digits/characters equals the number specified in the parameter len. If len is not specified, it will add preceding zeroes until the number of digits/characters equals 8.
If parameter prefix is specified, it will additionally add the inputted string in the beginning of the ID string. If prefix is not specified, it will not add anything else. The adding of the prefix happens before the insertion of additional zeroes, i.e. zeroes will be inserted between prefix and ID number until the total number of digits/characters (including the prefix) equals the specified length.
Usually used when creating a new record to insert into the repository (see "Insert Record").
Example
The following program illustrates the function call:
The function will generate the new ID "EU00000120" (for the case that the newest record that is currently in the repository has the Primary Key Value "119") for the Primary Key column "ID" and store it in the variable "newId".
Last updated