Read Columns
Syntax
Arguments
columns
Expression<Func<T, TResult>>
Criteria by which the records of the repository should be filtered.
This parameter must not be empty.
filter
Expression<Func<T, bool>>
Criteria by which the records of the repository should be filtered.
This parameter must not be empty.
null
orderBy
Func<IQueryable, IOrderedQueryable>
Order in which the filtered records should be listed.
This parameter is optional.
null
includeProperties
string
Navigation properties (recognized by the key word "virtual") that should be included.
This parameter is optional.
""
maxRows
int?
Maximal number of records that should be filtered.
This parameter is optional.
null
Description
Gets all the columns that are specified in the parameter columns from all the records of a repository that fulfill the criteria specified in the parameter filter.
If orderBy is not null, it first orders the records according to the attributes specified in the parameter orderBy before getting the columns from the newly ordered list.
If includeProperties is not null, it additionally loads the navigation properties that are specified in the parameter includeProperties. Navigation properties are "virtual" properties of the repository, i.e. they are not real properties and are accessed by navigating to another object. They would not get loaded unless specified in this parameter.
If maxRows is not 0, it makes sure that the number of filtered records does not exceed the specified number.
Example
Example 1: Reading only one specific column
The following program illustrates the function call with only one specified column:
Function will load the column "ProductID" from the records of the repository that have "ADAM-567-BTO" as Production ID and store the result into the variable "orderColumns".
Example 2: Reading multiple columns
The following program illustrates the function call with three specified columns:
Function will load the columns "ProductID", "ID" and "Quantity" from the records of the repository that have "ADAM-567-BTO" as Production ID and store the result into the variable "orderColumns".
Example 3: Reading multiple columns with custom names
The following program illustrates the function call with three specified columns where two of them are given custom names:
Function will load the columns "ProductID", "ID" and "Quantity" from the records of the repository that have "ADAM-567-BTO" as Production ID and store the result into the variable "orderColumns", renaming the item "ProductionID" into "ProductName" and "ID" into "OrderNumber". The item "Quantity" maintains its name from the repository.
Example 4: Reading multiple columns and multiple filter criteria
Function will load the columns "ProductID" and "ID" from the records of the repository that have "ADAM-567-BTO" as Production ID, have a Quantity of more than 10 and are Urgent, and store the result into the variable "orderColumns".
Example 5: Reading multiple columns with order + maximum limit
Function will order the records by their Timestamp attribute, load the columns "ProductID" and "ID" from a maximum of 100 records of the ordered repository that have "ADAM-567-BTO" as Production ID and store the result into the variable "orderColumns".
Example 6: Reading multiple columns with order + maximum limit and including a virtual property
The following program illustrates the function call with multiple criteria, specified order, maximum limit and external property:
Function will order the records by their Timestamp attribute, load the columns "ProductID" and "ID" from a maximum of 100 records of the ordered repository that have "ADAM-567-BTO" as Production ID and a Quantity of more than 10, include the virtual property "SapOrder" (a navigation property of "Production Order") and store the result into the variable "orderList".
Last updated