Skip to content

LinqExtensions

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

TQueryLinqExtensions Class

Use Dapper with most of Linq methods as an System.Linq.IQueryable object without downloading the records. Dapper.NET and IQueryable issue.

Inheritance System.Object 🡒 TQueryLinqExtensions

TQuery Extension Methods
Query Result
Where<Table>(DbEc<Table>, Expression<Func<Table,bool>>) Filters a TQuery recordset based on a predicate.
Join<TOuter,TInner,TKey,TResult>(DbEc<TOuter>, DbEc<TInner>, Expression<Func<TOuter,TKey>>, Expression<Func<TInner,TKey>>, Expression<Func<TOuter,TInner,TResult>>, JoinType) Correlates the records of two TQuery recordsets based on matching keys.
Top<Table>(DbEc<Table>, int) Returns a specified number of contiguous records from the start of a TQuery recordset.
Bottom<Table>(DbEc<Table>, int) Returns a specified number of contiguous records from the end of a TQuery recordset.
Take<Table>(DbEc<Table>, int) Returns a specified number of contiguous records from the start of a TQuery recordset.
Skip<Table>(DbEc<Table>, int) Bypasses a specified number of records in a TQuery recordset and then returns the remaining records.
OrderBy<Table,TKey>(DbEc<Table>, Expression<Func<Table,TKey>>) Sorts the records of a TQuery recordset in ascending order according to a key.
OrderByDescending<Table,TKey>(DbEc<Table>, Func<Table,TKey>) Sorts the records of a TQuery recordset in descending order according to a key.
ThenBy<Table,TKey>(DbEcOrder<Table>, Expression<Func<Table,TKey>>) Performs a subsequent ordering of a TQuery recordset in ascending order according to a key.
ThenByDescending<Table,TKey>(DbEcOrder<Table>, Expression<Func<Table,TKey>>) Performs a subsequent ordering of a TQuery recordset in descending order according to a key.
Boolean Result
All<Table>(DbEc<Table>, Expression<Func<Table,bool>>) Determines whether all records of a TQuery recordset satisfy a condition.
Any<Table>(DbEc<Table>) Determines whether a TQuery recordset contains any records.
Any<Table>(DbEc<Table>, Expression<Func<Table,bool>>) Determines whether any record of a TQuery recordset satisfy a condition.
Entity Result
First<Table>(DbEc<Table>) Executes a single-row query, returning the first record of the TQuery recordset.
First<Table>(DbEc<Table>, Expression<Func<Table,bool>>) Executes a single-row query, returning the first record of the TQuery recordset that satisfies a specified condition.
FirstOrDefault<Table>(DbEc<Table>) Executes a single-row query, returning the first record of the TQuery recordset, or NULL if no record is found.
FirstOrDefault<Table>(DbEc<Table>, Expression<Func<Table,bool>>) 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.
Single<Table>(DbEc<Table>) Returning the only record of the TQuery recordset, and throws an exception if there is not exactly one record.
Single<Table>(DbEc<Table>, Expression<Func<Table,bool>>) Returning the only record of the TQuery recordset that satisfies a specified condition, and throws an exception if there is not exactly one record that satisfies the predicate function.
SingleOrDefault<Table>(DbEc<Table>) Returning the only record of the TQuery recordset, or NULL if no such record is found, and throws an exception if there is not exactly one record.
SingleOrDefault<Table>(DbEc<Table>, Expression<Func<Table,bool>>) Returning the only record of the TQuery recordset that satisfies a specified condition, or NULL if no such record is found, and throws an exception if there is not exactly one record that satisfies the predicate function.
Select<Table,TResult>(DbEc<Table>, Expression<Func<Table,TResult>>) Projects the TQuery recordset into a new form of a result table by selecting specific columns or calculations to retrieve from the table.
Select<Table,TResult>(DbEcOrder<Table>, Expression<Func<Table,TResult>>) Projects the TQuery recordset into a new form of a result table by selecting specific columns or calculations to retrieve from the table.
TQueryExtended Extension Methods
Boolean Result
All<Table>(DbEcExtended<Table>, Expression<Func<Table,bool>>) Determines whether all records of a TQuery recordset satisfy a condition.
Any<Table>(DbEcExtended<Table>) Determines whether a TQuery recordset contains any records.
Any<Table>(DbEcExtended<Table>, Expression<Func<Table,bool>>) Determines whether any record of a TQuery recordset satisfy a condition.
Entity Result
First<Table>(DbEcExtended<Table>) Executes a single-row query, returning the first record of the TQuery recordset.
First<Table>(DbEcExtended<Table>, Expression<Func<Table,bool>>) Executes a single-row query, returning the first record of the TQuery recordset that satisfies a specified condition.
FirstOrDefault<Table>(DbEcExtended<Table>) Executes a single-row query, returning the first record of the TQuery recordset, or NULL if no record is found.
FirstOrDefault<Table>(DbEcExtended<Table>, Expression<Func<Table,bool>>) 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.
Single<Table>(DbEcExtended<Table>) Returning the only record of the TQuery recordset, and throws an exception if there is not exactly one record.
Single<Table>(DbEcExtended<Table>, Expression<Func<Table,bool>>) Returning the only record of the TQuery recordset that satisfies a specified condition, and throws an exception if there is not exactly one record that satisfies the predicate function.
SingleOrDefault<Table>(DbEcExtended<Table>) Returning the only record of the TQuery recordset, or NULL if no such record is found, and throws an exception if there is not exactly one record.
SingleOrDefault<Table>(DbEcExtended<Table>, Expression<Func<Table,bool>>) Returning the only record of the TQuery recordset that satisfies a specified condition, or NULL if no such record is found, and throws an exception if there is not exactly one record that satisfies the predicate function.
Clone this wiki locally