Documentation
SolutionDeveloperComplianceProjects
  • Getting Started
  • Technology
    • Application Framework
    • Object-Relational Mapping
    • Security Framework
    • Architecture Pattern
    • API Management
  • Environment
    • Development Tool
    • Database Server
    • Web Server
  • PRESENTATION
    • Design Material
    • HTML Helpers
    • Icon Images
    • Custom CSS
    • JQuery Plugin
      • DataTables
      • Tabs
      • Date Picker
      • Calendar
      • Chart
      • Treeview
    • Client Script
      • Open Modal
      • Close Modal
      • Handle return data
      • Load Content
      • Change Hash
      • Change Title
      • Get actual Hash
      • Get Content
      • Update Content
      • Delete Content
      • Get Partial Content
      • Get Partial Content Async
      • Update Partial Content
      • Update Partial Content Async
      • Delete Partial Content
      • Get Action
      • Update Action
      • Delete Action
      • Cascading Dropdown
      • Display Document
    • MVC View
  • BACKEND
    • Base Controller
    • Controller
    • Base Model
    • View Model
    • Class Utility
      • Constant Values
      • Global Properties
      • Option Helper
      • Setting Helper
    • Data Repository
      • Read Columns
      • Read All Columns
      • Read First Record
      • Read by Primary Key
      • Find Record
      • Insert Record
      • Update Record
      • Delete Entity
      • Delete by Criteria
      • Delete by Primary Key
      • Counting Record
      • Check Exist
      • Generate Row-Id
    • Unit Of Work
    • Data Entity
  • Application Features
    • Account Management
    • Navigation Editor
    • Access Control
  • Examples
    • Simple Page
    • Master Detail
    • Editor Template
Powered by GitBook
On this page
  • Syntax
  • Arguments
  • Description
  • Example
  • Example 1: Filtering records by only one criterion
  • Example 2: Filtering records by multiple criteria
  • Example 3: Filtering records by multiple criteria with order
  • Example 4: Filtering records by multiple criteria with order + maximum limit
  • Example 5: Filtering records by multiple criteria with order + maximum limit and including an virtual property
  1. BACKEND
  2. Data Repository

Read All Columns

Syntax

Get(filter, orderBy, includeProperties, rows);

Arguments

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.

""

rows

int

Maximal number of records that should be filtered.

This parameter is optional.

0

Description

Gets all records from a repository that fulfill the criteria specified in the parameter filter. (Because it loads all columns instead of just specific ones, it is usually slower than "GetFields".)

If orderBy is not null, it first orders the records according to the attributes specified in the parameter orderBy before getting the records 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 rows is not 0, it makes sure that the number of filtered records does not exceed the specified number.

Example

Example 1: Filtering records by only one criterion

The following program illustrates the function call with only one criterion:

var orderList = repo.Get(x => x.ProductID == "ADAM-567-BTO");

Function will load all the records from the repository that have "ADAM-567-BTO" as Production ID and store the result into the variable "orderList".

Example 2: Filtering records by multiple criteria

The following program illustrates the function call with multiple criteria:

var orderList = repo.Get(x => x.ProductID == "ADAM-567-BTO" 
                           && x.Quantity > 10 
                           && x.IsUrgent == true);

Function will load all the records from 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 "orderList".

Example 3: Filtering records by multiple criteria with order

The following program illustrates the function call with multiple criteria and specified order:

var orderList = repo.Get(x => x.ProductID == "ADAM-567-BTO" 
                           && x.Quantity > 10, 
                       o => o.OrderBy(c => c.Timestamp);

Function will order the records by their Timestamp attribute, load all the records from the ordered repository that have "ADAM-567-BTO" as Production ID and a Quantity of more than 10, and store the result into the variable "orderList".

Example 4: Filtering records by multiple criteria with order + maximum limit

The following program illustrates the function call with multiple criteria, specified order and maximum limit:

var orderList = repo.Get(x => x.ProductID == "ADAM-567-BTO" 
                           && c.Quantity > 10, 
                         o => o.OrderBy(c => c.Timestamp), 
                         "",
                         100);

Function will order the records by their Timestamp attribute, load a maximum of 100 records from the ordered repository that have "ADAM-567-BTO" as Production ID and a Quantity of more than 10, and store the result into the variable "orderList".

Example 5: Filtering records by multiple criteria with order + maximum limit and including an virtual property

The following program illustrates the function call with multiple criteria, specified order, maximum limit and external property:

var orderList = repo.Get(x => x.ProductID == "ADAM-567-BTO" 
                           && c.Quantity > 10, 
                         o => o.OrderBy(c => c.Timestamp), 
                         "SapOrder",
                         100);

Function will order the records by their Timestamp attribute, load a maximum of 100 records from 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".

PreviousRead ColumnsNextRead First Record

Last updated 2 years ago