Find Record

Syntax

Find(id);

Arguments

id

Guid / long / 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. (In contrast to "GetByID", "Find" accepts not only string but also Guid and long as input.)

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 Entitty 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

Example 1: Finding a record by its Primary Key inputting a string value

The following program illustrates the function call with a string as input:

var orderFind = repo.Find("EU00781891");

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".

Example 2: Finding a record by its Primary Key inputting a long value

The following program illustrates the function call with a long as input:

var orderFind = repo.Find(1111111111);

Function will load the specific record from the repository that has "1111111111" as ID (a 64-bit two's complement integer used as identifier) and store the result into the variable "orderSingle".

Example 3: Finding a record by its Primary Key inputting a GUID value

The following program illustrates the function call with a GUID as input:

var orderFind = repo.Find(93acdcc2-c5d5-4176-ac0d-c190e03e1fb4);

Function will load the specific record from the repository that has "93acdcc2-c5d5-4176-ac0d-c190e03e1fb4" as GUID (128-bit integer called 'Globally Unique Identifier' used to identify resources in Microsoft technologies) and store the result into the variable "orderSingle".

Last updated