Table of Contents

Class CompiledQuery

Namespace
LinqToDB
Assembly
linq2db.dll

Provides API for compilation and caching of queries for reuse.

public class CompiledQuery
Inheritance
CompiledQuery
Extension Methods

Constructors

CompiledQuery(LambdaExpression)

protected CompiledQuery(LambdaExpression query)

Parameters

query LambdaExpression

Methods

Compile<TDC, TResult>(Expression<Func<TDC, TResult>>)

Compiles the query.

public static Func<TDC, TResult> Compile<TDC, TResult>(Expression<Func<TDC, TResult>> query) where TDC : IDataContext

Parameters

query Expression<Func<TDC, TResult>>

The query expression to be compiled.

Returns

Func<TDC, TResult>

A generic delegate that represents the compiled query.

Type Parameters

TDC

Type of data context parameter, passed to compiled query.

TResult

Query result type.

Compile<TDC, TArg1, TResult>(Expression<Func<TDC, TArg1, TResult>>)

Compiles the query with parameter.

public static Func<TDC, TArg1, TResult> Compile<TDC, TArg1, TResult>(Expression<Func<TDC, TArg1, TResult>> query) where TDC : IDataContext

Parameters

query Expression<Func<TDC, TArg1, TResult>>

The query expression to be compiled.

Returns

Func<TDC, TArg1, TResult>

A generic delegate that represents the compiled query.

Type Parameters

TDC

Type of data context parameter, passed to compiled query.

TArg1

Type of parameter for compiled query.

TResult

Query result type.

Compile<TDC, TArg1, TArg2, TResult>(Expression<Func<TDC, TArg1, TArg2, TResult>>)

Compiles the query with two parameters.

public static Func<TDC, TArg1, TArg2, TResult> Compile<TDC, TArg1, TArg2, TResult>(Expression<Func<TDC, TArg1, TArg2, TResult>> query) where TDC : IDataContext

Parameters

query Expression<Func<TDC, TArg1, TArg2, TResult>>

The query expression to be compiled.

Returns

Func<TDC, TArg1, TArg2, TResult>

A generic delegate that represents the compiled query.

Type Parameters

TDC

Type of data context parameter, passed to compiled query.

TArg1

Type of first parameter for compiled query.

TArg2

Type of second parameter for compiled query.

TResult

Query result type.

Compile<TDC, TArg1, TArg2, TArg3, TResult>(Expression<Func<TDC, TArg1, TArg2, TArg3, TResult>>)

Compiles the query with three parameters.

public static Func<TDC, TArg1, TArg2, TArg3, TResult> Compile<TDC, TArg1, TArg2, TArg3, TResult>(Expression<Func<TDC, TArg1, TArg2, TArg3, TResult>> query) where TDC : IDataContext

Parameters

query Expression<Func<TDC, TArg1, TArg2, TArg3, TResult>>

The query expression to be compiled.

Returns

Func<TDC, TArg1, TArg2, TArg3, TResult>

A generic delegate that represents the compiled query.

Type Parameters

TDC

Type of data context parameter, passed to compiled query.

TArg1

Type of first parameter for compiled query.

TArg2

Type of second parameter for compiled query.

TArg3

Type of third parameter for compiled query.

TResult

Query result type.

Compile<TDC, TArg1, TArg2, TArg3, TArg4, TResult>(Expression<Func<TDC, TArg1, TArg2, TArg3, TArg4, TResult>>)

Compiles the query with four parameters.

public static Func<TDC, TArg1, TArg2, TArg3, TArg4, TResult> Compile<TDC, TArg1, TArg2, TArg3, TArg4, TResult>(Expression<Func<TDC, TArg1, TArg2, TArg3, TArg4, TResult>> query) where TDC : IDataContext

Parameters

query Expression<Func<TDC, TArg1, TArg2, TArg3, TArg4, TResult>>

The query expression to be compiled.

Returns

Func<TDC, TArg1, TArg2, TArg3, TArg4, TResult>

A generic delegate that represents the compiled query.

Type Parameters

TDC

Type of data context parameter, passed to compiled query.

TArg1

Type of first parameter for compiled query.

TArg2

Type of second parameter for compiled query.

TArg3

Type of third parameter for compiled query.

TArg4

Type of forth parameter for compiled query.

TResult

Query result type.

Compile<TDC, TArg1, TArg2, TArg3, TArg4, TArg5, TResult>(Expression<Func<TDC, TArg1, TArg2, TArg3, TArg4, TArg5, TResult>>)

Compiles the query with five parameters.

public static Func<TDC, TArg1, TArg2, TArg3, TArg4, TArg5, TResult> Compile<TDC, TArg1, TArg2, TArg3, TArg4, TArg5, TResult>(Expression<Func<TDC, TArg1, TArg2, TArg3, TArg4, TArg5, TResult>> query) where TDC : IDataContext

Parameters

query Expression<Func<TDC, TArg1, TArg2, TArg3, TArg4, TArg5, TResult>>

The query expression to be compiled.

Returns

Func<TDC, TArg1, TArg2, TArg3, TArg4, TArg5, TResult>

A generic delegate that represents the compiled query.

Type Parameters

TDC

Type of data context parameter, passed to compiled query.

TArg1

Type of first parameter for compiled query.

TArg2

Type of second parameter for compiled query.

TArg3

Type of third parameter for compiled query.

TArg4

Type of forth parameter for compiled query.

TArg5

Type of fifth parameter for compiled query.

TResult

Query result type.

Invoke<TDC, TResult>(TDC)

Executes compiled query against provided database connection context.

public TResult Invoke<TDC, TResult>(TDC dataContext)

Parameters

dataContext TDC

Database connection context.

Returns

TResult

Query execution result.

Type Parameters

TDC

Database connection context type.

TResult

Query result type.

Invoke<TDC, T1, TResult>(TDC, T1)

Executes compiled query with one parameter against provided database connection context.

public TResult Invoke<TDC, T1, TResult>(TDC dataContext, T1 arg1)

Parameters

dataContext TDC

Database connection context.

arg1 T1

Query parameter value.

Returns

TResult

Query execution result.

Type Parameters

TDC

Database connection context type.

T1

Query parameter type.

TResult

Query result type.

Invoke<TDC, T1, T2, TResult>(TDC, T1, T2)

Executes compiled query with two parameters against provided database connection context.

public TResult Invoke<TDC, T1, T2, TResult>(TDC dataContext, T1 arg1, T2 arg2)

Parameters

dataContext TDC

Database connection context.

arg1 T1

First query parameter value.

arg2 T2

Second query parameter value.

Returns

TResult

Query execution result.

Type Parameters

TDC

Database connection context type.

T1

First query parameter type.

T2

Second query parameter type.

TResult

Query result type.

Invoke<TDC, T1, T2, T3, TResult>(TDC, T1, T2, T3)

Executes compiled query with three parameters against provided database connection context.

public TResult Invoke<TDC, T1, T2, T3, TResult>(TDC dataContext, T1 arg1, T2 arg2, T3 arg3)

Parameters

dataContext TDC

Database connection context.

arg1 T1

First query parameter value.

arg2 T2

Second query parameter value.

arg3 T3

Third query parameter value.

Returns

TResult

Query execution result.

Type Parameters

TDC

Database connection context type.

T1

First query parameter type.

T2

Second query parameter type.

T3

Third query parameter type.

TResult

Query result type.

Invoke<TDC, T1, T2, T3, T4, TResult>(TDC, T1, T2, T3, T4)

Executes compiled query with four parameters against provided database connection context.

public TResult Invoke<TDC, T1, T2, T3, T4, TResult>(TDC dataContext, T1 arg1, T2 arg2, T3 arg3, T4 arg4)

Parameters

dataContext TDC

Database connection context.

arg1 T1

First query parameter value.

arg2 T2

Second query parameter value.

arg3 T3

Third query parameter value.

arg4 T4

Forth query parameter value.

Returns

TResult

Query execution result.

Type Parameters

TDC

Database connection context type.

T1

First query parameter type.

T2

Second query parameter type.

T3

Third query parameter type.

T4

Forth query parameter type.

TResult

Query result type.

Invoke<TDC, T1, T2, T3, T4, T5, TResult>(TDC, T1, T2, T3, T4, T5)

Executes compiled query with five parameters against provided database connection context.

public TResult Invoke<TDC, T1, T2, T3, T4, T5, TResult>(TDC dataContext, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5)

Parameters

dataContext TDC

Database connection context.

arg1 T1

First query parameter value.

arg2 T2

Second query parameter value.

arg3 T3

Third query parameter value.

arg4 T4

Forth query parameter value.

arg5 T5

Fifth query parameter value.

Returns

TResult

Query execution result.

Type Parameters

TDC

Database connection context type.

T1

First query parameter type.

T2

Second query parameter type.

T3

Third query parameter type.

T4

Forth query parameter type.

T5

Fifth query parameter type.

TResult

Query result type.