Skip to content

TQueryLinqExtensions_FirstOrDefault_YYJNfritxMP_8wCst4FZlg

Jacob Spitzer edited this page Aug 28, 2022 · 2 revisions

TQueryLinqExtensions.FirstOrDefault<Table>(DbEcExtended<Table>, Expression<Func<Table,bool>>) Method

Executes a single-row query, returning the first record of the TQuery recordset that satisfies a specified condition, or NULL if no such record is found.

public static Table FirstOrDefault<Table>(this DbEasyConnect.DbEcExtended<Table> tQuery, System.Linq.Expressions.Expression<System.Func<Table,bool>> predicate);

Type parameters

Table
The type of the records of table class. need to be a class with the [Table("")] attribute.

Parameters

tQuery DbEasyConnect.DbEcExtended<Table>
An DbEcExtended<T> to apply the predicate to.

predicate System.Linq.Expressions.Expression<System.Func<Table,System.Boolean>>
A function to test each record for a condition.

Returns

Table
NULL if TQuery recordset is empty or if no record passes the test specified by predicate; otherwise, the first record in TQuery recordset that passes the test specified by predicate.

Clone this wiki locally