Skip to content

vzabavnov/Fluentsoft.Queryable

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Queryable Class

Definitions

Namespace: Fluentsoft.System.Linq
Assembly: fluentsoft.queryable.dll
Package: Fluentsoft.Queryable

Namespace: Fluentsoft.System.Linq

class Description
Queryable Extension methods for IQueryable
ExpressionExtensions Extsnsions methods for Expression

class Queryable {#Queryable_ref}

Provides a set of extensions methods for querying data structures that implement IQueryable.

Method Description
IQueryable<TResult> LeftOuterJoin<TOuter, TInner, TKey, TResult>(IQueryable<TOuter> outer, IEnumerable<TInner> inner, Expression<Func<TOuter, TKey>> outerKey, Expression<Func<TInner, TKey>> innerKey, Expression<Func<TOuter, TInner?, TResult>> resultSelector) Correlates all records from the left table, and the matching records from the right table based on matching keys
IQueryable<TResult> RightOuterJoin<TOuter, TInner, TKey, TResult>(this IEnumerable<TOuter> outer, IQueryableTInner> inner, Expression<Func<TOuter, TKey>> outerKey, Expression<Func<TInner, TKey>> innerKey, Expression<Func<TOuter?, TInner, TResult>> resultSelector) Correlates all records from the right table, and the matching records from the left table based on matching keys
IQueryable<TResult> FullOuterJoin<TOuter, TInner, TKey, TResult>(this IQueryable<TOuter> outer, IQueryable<TInner> inner, Expression<Func<TOuter, TKey>> outerKey, Expression<Func<TInner, TKey>> innerKey, Expression<Func<TOuter?, TInner?, TResult>> resultSelector) Correlates all records from the right table, and all records from the left table based on matching keys
IQueryable<TResult> Select<T, TResult, T1, T2>(IQueryable<T> source, Expression<Func<T1, T2, TResult>> selector) Projects each element of a sequence into a new form.
IQueryable<TResult> Select<T, TResult, T1, T2, T3>(IQueryable<T> source, Expression<Func<T1, T2, T3, TResult>> selector) Projects each element of a sequence into a new form.
IQueryable<T> Where<T, T1, T2, T3>(IQueryable<T> source, Expression<Func<T1, T2, T3, bool>> predicate) Filters a sequence of values based on a predicate with three arguments taken from source value by splitting.
IQueryable<T> Where<T, T1, T2>(IQueryable<T> source, Expression<Func<T1, T2, bool>> predicate) Filters a sequence of values based on a predicate with two arguments taken from source value by splitting.

LeftOuterJoin

Correlates all records from the left table, and the matching records from the right table based on matching keys

public static IQueryable<TResult> LeftOuterJoin<TOuter, TInner, TKey, TResult>(this 
    IQueryable<TOuter> outer,
    IEnumerable<TInner> inner,
    Expression<Func<TOuter, TKey>> outerKey,
    Expression<Func<TInner, TKey>> innerKey,
    Expression<Func<TOuter, TInner?, TResult>> resultSelector);

Type Parameters

TOuter The type of the elements of the first sequence.

TInner The type of the elements of the second sequence.

TKey The type of the keys returned by the key selector functions.

TResult The type of the result elements.

Parameters

outer IQueryable<TOuter>
The first sequence to join.

inner IEnumerable<TInner>
The sequence to join to the first sequence.

outerKeySelector Expression<Func<TOuter,TKey>>
A function to extract the join key from each element of the first sequence.

innerKeySelector Expression<Func<TInner,TKey>>
A function to extract the join key from each element of the second sequence.

resultSelector Expression<Func<TOuter,TInner,TResult>>
A function to create a result element from two matching elements.

Returns

IQueryable<TResult>
An IQueryable<T> that has elements of type TResult obtained by performing an left outer join on two sequences.

Example

ctx.Departments.LeftOuterJoin(ctx.Employees,
    z => z.ID,
    z => z.DepartmentID,
    (department, employee) => new
    {
        Department = department.Name,
        Employee = employee.Name,
    })

RughtOuterJoin

public static IQueryable<TResult> RughtOuterJoin<TOuter, TInner, TKey, TResult>(this 
    IEnumerable<TOuter> outer,
    IQueryable<TInner> inner,
    Expression<Func<TOuter, TKey>> outerKey,
    Expression<Func<TInner, TKey>> innerKey,
    Expression<Func<TOuter, TInner?, TResult>> resultSelector);

Type Parameters

TOuter The type of the elements of the first sequence.

TInner The type of the elements of the second sequence.

TKey The type of the keys returned by the key selector functions.

TResult The type of the result elements.

Parameters

outer IEnumerable<TOuter>
The first sequence to join.

inner IQueryable<TInner>
The sequence to join to the first sequence.

outerKeySelector Expression<Func<TOuter,TKey>>
A function to extract the join key from each element of the first sequence.

innerKeySelector Expression<Func<TInner,TKey>>
A function to extract the join key from each element of the second sequence.

resultSelector Expression<Func<TOuter,TInner,TResult>>
A function to create a result element from two matching elements.

Returns

IQueryable<TResult>
An IQueryable<T> that has elements of type TResult obtained by performing an right outer join on two sequences.

Example

ctx.Departments.RightOuterJoin(ctx.Employees,
    z => z.ID,
    z => z.DepartmentID,
    (department, employee) => new
    {
        Department = department.Name,
        Employee = employee.Name,
    })

FullOuterJoin

public static IQueryable<TResult> FullOuterJoin<TOuter, TInner, TKey, TResult>(this 
    IQueryable<TOuter> outer,
    IQueryable<TInner> inner,
    Expression<Func<TOuter, TKey>> outerKey,
    Expression<Func<TInner, TKey>> innerKey,
    Expression<Func<TOuter, TInner?, TResult>> resultSelector);

Type Parameters

TOuter The type of the elements of the first sequence.

TInner The type of the elements of the second sequence.

TKey The type of the keys returned by the key selector functions.

TResult The type of the result elements.

Parameters

outer IQueryable<TOuter>
The first sequence to join.

inner IQueryable<TInner>
The sequence to join to the first sequence.

outerKeySelector Expression<Func<TOuter,TKey>>
A function to extract the join key from each element of the first sequence.

innerKeySelector Expression<Func<TInner,TKey>>
A function to extract the join key from each element of the second sequence.

resultSelector Expression<Func<TOuter,TInner,TResult>>
A function to create a result element from two matching elements.

Returns

IQueryable<TResult>
An IQueryable<T> that has elements of type TResult obtained by performing an full outer join on two sequences.

Example

ctx.Departments.FullOuterJoin(ctx.Employees,
    z => z.ID,
    z => z.DepartmentID,
    (department, employee) => new
    {
        Department = department.Name,
        Employee = employee.Name,
    })

class ExpressionExtensions {#ExpressionExtensions_ref}

Method Description
Expression<Func<T2, T1, TResult>> SwitchParameters<T1, T2, TResult>(Expression<Func<T1, T2, TResult>> expression) Translate the source to result expression by switch arguments
Expression<Func<T, TResult>> SplitParameters<T1, T2, T, TResult>(this Expression<Func<T1, T2, TResult>> expression) Translate source with two arguments to expression with type where arguments are property of that type
Expression<Func<T, TResult>> SplitParameters<T1, T2, T3, T, TResult>(this Expression<Func<T1, T2, T3, TResult>> expression) Translate source with two arguments to expression with type where arguments are property of that type