Table of Contents

Namespace LinqToDB

Classes

AnalyticFunctions
CompiledQuery

Provides API for compilation and caching of queries for reuse.

CreateTableOptions

Options for creating a table.

CreateTempTableOptions

Options for creating a temporary table.

CteBuilderExtensions

Extension methods that expose CTE options on ICteBuilder.

DataContext

Implements abstraction over non-persistent database connection that could be released after query or transaction execution.

DataContextOptions
DataContextTransaction

Explicit data context DataContext transaction wrapper.

DataExtensions

Data context extension methods.

DataOptions

Immutable context configuration object.

DataOptionsExtensions

Set of extensions for DataOptions.

DataOptions<T>

Typed DataOptions wrapper to support multiple option objects registration in DI containers.

ExprParameterAttribute
ExpressionMethodAttribute

When applied to method or property, tells linq2db to replace them in queryable LINQ expression with another expression, returned by method, specified in this attribute.

Requirements to expression method:

- expression method should be in the same class and replaced property of method; - method could be private.

When applied to property, expression: - method should return function expression with the same return type as property type; - expression method could take up to two parameters in any order - current object parameter and database connection context object.

When applied to method: - expression method should return function expression with the same return type as method return type; - method cannot have void return type; - parameters in expression method should go in the same order as in substituted method; - expression could take method instance object as first parameter; - expression could take database connection context object as last parameter; - last method parameters could be ommited from expression method, but only if you don't add database connection context parameter.

ExtensionBuilderExtensions
KeepConnectionAliveScope

Explicit DataContext connection reuse scope. See KeepConnectionAlive for more details.

LinqExtensions

Contains extension methods for LINQ queries.

LinqOptions
LinqToDBException

Exception type for exceptions, thrown by Linq To DB.

MergeDefinition<TTarget, TSource>
MergeDefinition<TTarget, TSource>.Operation
MultiInsertExtensions
ProviderName

Default names for providers.

QuerySql

Command SQL, generated from linq query.

ServerSideOnlyException

Exception to throw for server-side only APIs, called on client.

Sql
Sql.AggregateFunctionNotOrderedImpl<T, TR>
Sql.ConvertTo<TTo>
Sql.EnumAttribute
Sql.ExpressionAttribute

An Attribute that allows custom Expressions to be defined for a Method used within a Linq Expression.

Sql.ExtensionAttribute
Sql.ExtensionAttribute.ExtensionBuilder<TContext>
Sql.FunctionAttribute

Defines an SQL server-side Function with parameters passed in.

Sql.PropertyAttribute

An attribute used to define a static value or a Database side property/method that takes no parameters.

Sql.QueryExtensionAttribute

Defines custom query extension builder.

Sql.SqlExtension
Sql.SqlExtensionParam
Sql.SqlQueryExtensionData
Sql.SqlRow
Sql.SqlRow<T1>
Sql.SqlRow<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>
Sql.SqlRow<T1, T2>
Sql.SqlRow<T1, T2, T3>
Sql.SqlRow<T1, T2, T3, T4>
Sql.SqlRow<T1, T2, T3, T4, T5>
Sql.SqlRow<T1, T2, T3, T4, T5, T6>
Sql.SqlRow<T1, T2, T3, T4, T5, T6, T7>
Sql.SqlRow<T1, T2, T3, T4, T5, T6, T7, T8>
Sql.SqlRow<T1, T2, T3, T4, T5, T6, T7, T8, T9>
Sql.TableExpressionAttribute
Sql.TableFunctionAttribute
Sql.Types
SqlExtensions
SqlGenerationOptions

SQL generation options for ToSqlQuery<T>(IQueryable<T>, SqlGenerationOptions?) group of APIs.

SqlOptions
StringAggregateExtensions
TableExtensions

Contains extension methods for LINQ queries.

TempTable<T>

Temporary table. Temporary table is a table, created when you create instance of this class and deleted when you dispose it. It uses regular tables even if underlying database supports temporary tables concept.

UpdateOutput<T>
WindowFunctionBuilder

Provides SQL window function support via a fluent lambda-based API accessed through Window.

Structs

DbDataType

Stores database type attributes.

RawSqlString

A string representing a raw SQL query. This type enables overload resolution between the regular and interpolated FromSql<TEntity>(IDataContext, RawSqlString, params object?[]).

Sql.SqlID

Interfaces

AnalyticFunctions.IAggregateFunctionSelfContained<TR>
AnalyticFunctions.IAggregateFunction<TR>
AnalyticFunctions.IAnalyticFunctionWithoutWindow<TR>
AnalyticFunctions.IAnalyticFunction<TR>
AnalyticFunctions.IAndExpected<TR>
AnalyticFunctions.IBetweenStartExpected<TR>
AnalyticFunctions.IBoundaryExpected<TR>
AnalyticFunctions.INeedOrderByAndMaybeOverWithPartition<TR>
AnalyticFunctions.INeedSingleOrderByAndMaybeOverWithPartition<TR>
AnalyticFunctions.INeedsOrderByOnly<TR>
AnalyticFunctions.INeedsWithinGroupWithOrderAndMaybePartition<TR>
AnalyticFunctions.INeedsWithinGroupWithOrderOnly<TR>
AnalyticFunctions.INeedsWithinGroupWithSingleOrderAndMaybePartition<TR>
AnalyticFunctions.IOrderedAcceptOverReadyToFunction<TR>
AnalyticFunctions.IOrderedReadyToFunction<TR>
AnalyticFunctions.IOrderedReadyToWindowing<TR>
AnalyticFunctions.IOverMayHavePartitionAndOrder<TR>
AnalyticFunctions.IOverMayHavePartition<TR>
AnalyticFunctions.IOverWithPartitionNeeded<TR>
AnalyticFunctions.IPartitionDefinedReadyForSortingWithWindow<TR>
AnalyticFunctions.IPartitionedMayHaveOrder<TR>
AnalyticFunctions.IReadyForFullAnalyticClause<TR>
AnalyticFunctions.IReadyForSortingWithWindow<TR>
AnalyticFunctions.IReadyToFunctionOrOverWithPartition<TR>
AnalyticFunctions.IReadyToFunction<TR>
AnalyticFunctions.ISecondBoundaryExpected<TR>
ICteBuilder

Fluent builder for configuring a common table expression (CTE) declared via AsCte<TSource>(IQueryable<TSource>, Action<ICteBuilder>). Provider-specific options are exposed as extension methods over this interface.

IDataContext

Database connection abstraction interface.

IExtensionsAdapter

Interface to override default implementation of LINQ To DB async operations.

ILoadWithQueryable<TEntity, TProperty>

Provides support for queryable LoadWith/ThenLoad chaining operators.

ITable<T>

Table-like queryable source, e.g. table, view or table-valued function.

MultiInsertExtensions.IMultiInsertElse<TSource>
MultiInsertExtensions.IMultiInsertInto<TSource>
MultiInsertExtensions.IMultiInsertSource<TSource>
MultiInsertExtensions.IMultiInsertWhen<TSource>
Sql.IAggregateFunctionNotOrdered<T, TR>
Sql.IAggregateFunctionOrdered<T, TR>
Sql.IAggregateFunction<T, TR>
Sql.IExtensionCallBuilder
Sql.IGroupBy
Sql.IQueryableContainer
Sql.ISqlExtension
Sql.ISqlExtensionBuilder
Sql.IWindowFunction
WindowFunctionBuilder.IAggregateFinal

Builder for aggregate window functions with an argument: COUNT(expr), SUM, AVG, MIN, MAX.

Chain: [.Distinct()][.Filter(...)][.PartitionBy(...)][.OrderBy(...)][.RowsBetween|RangeBetween...], or .UseWindow(...).

Optional DISTINCT aggregate modifier, then the standard aggregate clauses (single-shot Distinct). UseWindow applies a reusable window definition (from DefineWindow) and is an alternative to the inline clauses, not combined with them.

WindowFunctionBuilder.IBivariateAggregateFinal

Builder for two-argument statistical window aggregates: COVAR_POP/COVAR_SAMP, CORR, REGR_*.

Chain: [Filter(...)][.PartitionBy(...)][.OrderBy(...)][.RowsBetween|RangeBetween...], or .UseWindow(...).

Supports FILTER, frame specification, and UseWindow. Does NOT support DISTINCT or KEEP — neither is valid on two-argument aggregates.

WindowFunctionBuilder.IBoundaryPart<TBoundaryDefined>

Provides frame boundary options: UNBOUNDED, CURRENT ROW, or a directed value offset.

WindowFunctionBuilder.IDefinedFunction

Marker interface indicating the window function definition is complete and can be returned from the builder lambda.

WindowFunctionBuilder.IDefinedFunction<TR>

Marker interface indicating the window function definition is complete and can be returned from the builder lambda.

WindowFunctionBuilder.IDefinedRangeFrameFunction

Provides optional frame exclusion after the frame boundary specification.

WindowFunctionBuilder.IDefinedWindow

A reusable window definition created by DefineWindow(IWindowFunction, Func<IWindowBuilder, IDefinedFunction>). Pass to UseWindow() to reference it.

WindowFunctionBuilder.IDistinctPart<TNext>

Provides the DISTINCT aggregate modifier for aggregate window functions (COUNT(expr)/SUM/AVG/MIN/MAX).

WindowFunctionBuilder.IFilterPart<TFiltered>

Provides the FILTER (WHERE ...) clause for aggregate window functions.

WindowFunctionBuilder.IFramePartFunction

Provides frame type selection: ROWS, RANGE, or GROUPS with BETWEEN syntax.

WindowFunctionBuilder.IFromPart<TNext>

Provides the FROM FIRST / FROM LAST modifier for NTH_VALUE.

WindowFunctionBuilder.IKeepOrderByRequired

Builder state after KeepFirst/KeepLast — requires mandatory ORDER BY.

Chain: .OrderBy(...)[.ThenBy(...)][.PartitionBy(...)]

WindowFunctionBuilder.IKeepPart<TKeepOrderBy>

Provides KEEP (DENSE_RANK FIRST/LAST) clause for aggregate window functions. Oracle-specific.

WindowFunctionBuilder.IKeepThenByOrPartitionFinal

Builder state after KEEP ORDER BY — allows ThenBy, optional PartitionBy, or completes.

WindowFunctionBuilder.ILeadLagFinal

Builder for offset window functions: LEAD, LAG.

Chain: [.IgnoreNulls()|.RespectNulls()] [UseWindow(wnd)] | [PartitionBy(...)].OrderBy(...)[.ThenBy(...)]

Optional null treatment, then mandatory ORDER BY (via the inherited chain).

WindowFunctionBuilder.IMultipleOrderByPart

Provides ORDER BY for ordered-set aggregate functions (e.g. PERCENTILE_DISC) that allow multiple ordering columns.

WindowFunctionBuilder.IMultipleThenByPart<TValue>

Provides additional ORDER BY columns after the first one in ordered-set aggregates, plus an optional FILTER (WHERE ...).

WindowFunctionBuilder.INthValueFinal

Builder for NTH_VALUE. Optional FROM FIRST/LAST then optional IGNORE/RESPECT NULLS (in SQL order), then the window spec.

Chain: [.FromFirst()|.FromLast()] [.IgnoreNulls()|.RespectNulls()] [UseWindow(wnd)] | [PartitionBy(...)][.OrderBy(...)][.RowsBetween|RangeBetween...]

WindowFunctionBuilder.INthValueNullsStep

Builder state after FROM FIRST/LAST on NTH_VALUE — allows optional IGNORE/RESPECT NULLS, then the window spec.

WindowFunctionBuilder.INullTreatmentPart<TNext>

Provides function-level null treatment (IGNORE NULLS / RESPECT NULLS) for value/offset window functions.

WindowFunctionBuilder.IOFilterOPartitionOOrderOFrameFinal

Builder for aggregate window functions: SUM, AVG, MIN, MAX.

Chain: [Filter(...)][.PartitionBy(...)][.OrderBy(...)][.RowsBetween|RangeBetween...], or .UseWindow(...).

Or with KEEP: [.KeepFirst()|.KeepLast()].OrderBy(...)[.ThenBy(...)][.PartitionBy(...)]

All clauses are optional. Supports FILTER, frame specification, UseWindow, and KEEP (Oracle) — UseWindow (a reusable window definition from DefineWindow) and KEEP are alternatives to the inline clauses, not combined with them.

WindowFunctionBuilder.IOFrameFinal

Terminal state after OrderBy in frame-capable chains: allows frame specification or completes.

WindowFunctionBuilder.IOPartitionFinal

State providing PartitionBy only, then completes.

WindowFunctionBuilder.IOPartitionOOrderOFrameFinal

State providing PartitionBy, OrderBy, and frame specification.

WindowFunctionBuilder.IOPartitionOOrderOFrameWithWindowFinal

Builder for value window functions: FIRST_VALUE, LAST_VALUE, NTH_VALUE.

Chain: [PartitionBy(...)][.OrderBy(...)][.RowsBetween|RangeBetween...], or .UseWindow(...).

Supports frame specification and UseWindow (a reusable window definition from DefineWindow, an alternative to the inline clauses). Does NOT support FILTER clause.

WindowFunctionBuilder.IOPartitionROrderFinal

Builder for ranking functions: ROW_NUMBER, RANK, DENSE_RANK, PERCENT_RANK, CUME_DIST, NTILE, LEAD, LAG.

Chain: [UseWindow(wnd)] | [PartitionBy(...)].OrderBy(...)[.ThenBy(...)]

ORDER BY is mandatory. FILTER and frame clauses are not available.

WindowFunctionBuilder.IOThenPartOFrameFinal

State after OrderBy in frame-capable chains: allows ThenBy, frame specification, or completes.

WindowFunctionBuilder.IOnlyOrderByPart

Provides ORDER BY for ordered-set aggregate functions (e.g. PERCENTILE_CONT) that require exactly one ordering column.

WindowFunctionBuilder.IOrderByPart<TThenPart>

Provides ORDER BY for the window function.

WindowFunctionBuilder.IOrderOFrameFinal

State providing OrderBy in frame-capable chains.

WindowFunctionBuilder.IOrderedSetFilter<TValue>

Terminal for ordered-set aggregates (PERCENTILE_CONT/DISC): optionally adds FILTER (WHERE ...) or completes the definition.

WindowFunctionBuilder.IOrderedSetWindowMultiOrder

Within-group ORDER BY for a windowed multi-key ordered-set aggregate (Sql.Window.PercentileDisc): the first sort key, then ThenBy/ThenByDesc, then an optional OVER (PARTITION BY ...).

WindowFunctionBuilder.IOrderedSetWindowPartition<TValue>

Optional OVER (PARTITION BY ...) for a windowed single-key ordered-set aggregate, then completes.

WindowFunctionBuilder.IOrderedSetWindowSingleOrder

Within-group ORDER BY for a windowed single-key ordered-set aggregate (Sql.Window.PercentileCont): the sort key, then an optional OVER (PARTITION BY ...).

WindowFunctionBuilder.IOrderedSetWindowThenBy<TValue>

Additional WITHIN GROUP ORDER BY columns for a windowed ordered-set aggregate, plus an optional OVER (PARTITION BY ...).

WindowFunctionBuilder.IPartitionPart<TPartitioned>

Provides the PARTITION BY clause.

WindowFunctionBuilder.IROrderByPartOThenByPartFinal

State requiring OrderBy, then allows ThenBy. Used after PartitionBy in ranking functions.

WindowFunctionBuilder.IRangePrecedingPartFunction

Provides the AND separator between start and end frame boundaries.

WindowFunctionBuilder.IThenByPartFinal

Terminal state after OrderBy: allows ThenBy or completes the definition.

WindowFunctionBuilder.IThenOrderPart<TThenPart>

Provides additional ORDER BY columns via ThenBy/ThenByDesc.

WindowFunctionBuilder.IUseWindow<TWithWindowPart>

Provides the ability to reference a predefined window definition.

WindowFunctionBuilder.IValueFinal

Builder for value window functions: FIRST_VALUE, LAST_VALUE.

Chain: [.IgnoreNulls()|.RespectNulls()] [UseWindow(wnd)] | [PartitionBy(...)][.OrderBy(...)][.RowsBetween|RangeBetween...]

WindowFunctionBuilder.IWindowBuilder

Builder interface for DefineWindow(IWindowFunction, Func<IWindowBuilder, IDefinedFunction>). Allows specifying PartitionBy, OrderBy, and frame clauses.

Enums

CompareNulls

Defines how null values are compared in generated SQL queries.

DataType

List of data types, supported by linq2db. Provider-level support depends on database capabilities and current implementation support level and could vary for different providers.

EagerLoadingStrategy

Specifies the strategy used to execute eager loading (LoadWith/ThenLoad) preamble queries.

ExprParameterKind
ImplicitCollectionLoading

Controls whether a collection projected without an explicit eager-load request — i.e. without LoadWith/ThenLoad or a WithUnionLoadStrategy/WithKeyedLoadStrategy/WithSeparateLoadStrategy marker — is allowed. Set via ImplicitCollectionLoading.

MergeOperationType
Sql.AggregateModifier
Sql.DateParts
Sql.From
Sql.IsNullableType

Provides information when function or expression could return null.

Sql.Nulls
Sql.NullsPosition
Sql.QueryExtensionScope

Defines query extension location/scope.

Sql.SqlIDType
Sql.TableQualification
SqlJoinType

Defines join type. Used with join LINQ helpers.

TableOptions

Provides table mapping flags to specify temporary table kind if mapped table is temporary table and Create/Drop Table API behavior when target table exists/not exists.

TakeHints

Hints for Take Take<TSource>(IQueryable<TSource>, int, TakeHints) Take<TSource>(IQueryable<TSource>, Expression<Func<int>>, TakeHints).

UpsertEmulationPolicy

Controls what happens when an Upsert cannot be expressed as a native single-statement upsert or MERGE for the target provider and would fall back to an emulated multi-statement SELECT → UPDATE → INSERT sequence. See UpsertEmulationPolicy.

Delegates

InsertColumnFilter<T>

Defines signature for column filter for insert operations.

InsertOrUpdateColumnFilter<T>

Defines signature for column filter for insert or update/replace operations.

Sql.ExpressionAttribute.ConvertFunc<TContext>
UpdateColumnFilter<T>

Defines signature for column filter for update operations.