Read by Primary Key

Syntax

GetByID(id);

Arguments

id

string

Value of the Primary Key of the to-be-read record.

This parameter must not be empty.

Description

Gets the specific record from a repository whose Primary Key value matches the one specified in the parameter id.

Primary Key refers to the column of a data table that contains the identifier of each row (the value that unambiguously distinguishes a record from the rest), i.e. no two records can have the same Primary Key value. You can check which column is the Primary Key by opening the Entity file of the data table and see which property is preceded by "[Key]".

If the input does not match the Primary Key of any record in the repository, an error will be thrown.

Example

The following program illustrates the function call:

var orderSingle = repo.GetByID("EU00899091");

Function will load the specific record from the repository that has "EU00899091" as ID (the Primary Key of the data table "Production Orders") and store the result into the variable "orderSingle".

Last updated