Table of Contents

Class MultiInsertExtensions

Namespace
LinqToDB
Assembly
linq2db.dll
public static class MultiInsertExtensions
Inheritance
MultiInsertExtensions

Methods

Else<TSource, TTarget>(IMultiInsertWhen<TSource>, ITable<TTarget>, Expression<Func<TSource, TTarget>>)

Insert into target table when previous conditions don't match.

public static MultiInsertExtensions.IMultiInsertElse<TSource> Else<TSource, TTarget>(this MultiInsertExtensions.IMultiInsertWhen<TSource> source, ITable<TTarget> target, Expression<Func<TSource, TTarget>> setter) where TTarget : notnull

Parameters

source MultiInsertExtensions.IMultiInsertWhen<TSource>

Source query, that returns data for insert operation.

target ITable<TTarget>

Target table to insert into.

setter Expression<Func<TSource, TTarget>>

Update expression. Uses record from source query as parameter. Expression supports only target table record new expression with field initializers.

Returns

MultiInsertExtensions.IMultiInsertElse<TSource>

Type Parameters

TSource

Source query record type.

TTarget

Target table record type.

InsertAllAsync<TSource>(IMultiInsertElse<TSource>, CancellationToken)

Asynchronously inserts source data into every matching condition.

public static Task<int> InsertAllAsync<TSource>(this MultiInsertExtensions.IMultiInsertElse<TSource> insert, CancellationToken token = default)

Parameters

insert MultiInsertExtensions.IMultiInsertElse<TSource>

Multi-table insert to perform.

token CancellationToken

Cancellation token for async operation.

Returns

Task<int>

Number of inserted rows.

Type Parameters

TSource

Source query record type.

InsertAll<TSource>(IMultiInsertElse<TSource>)

Inserts source data into every matching condition.

public static int InsertAll<TSource>(this MultiInsertExtensions.IMultiInsertElse<TSource> insert)

Parameters

insert MultiInsertExtensions.IMultiInsertElse<TSource>

Multi-table insert to perform.

Returns

int

Number of inserted rows.

Type Parameters

TSource

Source query record type.

InsertAsync<TSource>(IMultiInsertInto<TSource>, CancellationToken)

Asynchronously inserts source data into every configured table.

public static Task<int> InsertAsync<TSource>(this MultiInsertExtensions.IMultiInsertInto<TSource> insert, CancellationToken token = default)

Parameters

insert MultiInsertExtensions.IMultiInsertInto<TSource>

Multi-table insert to perform.

token CancellationToken

Cancellation token for async operation.

Returns

Task<int>

Number of inserted rows.

Type Parameters

TSource

Source query record type.

InsertFirstAsync<TSource>(IMultiInsertElse<TSource>, CancellationToken)

Asynchronously inserts source data into the first matching condition.

public static Task<int> InsertFirstAsync<TSource>(this MultiInsertExtensions.IMultiInsertElse<TSource> insert, CancellationToken token = default)

Parameters

insert MultiInsertExtensions.IMultiInsertElse<TSource>

Multi-table insert to perform.

token CancellationToken

Cancellation token for async operation.

Returns

Task<int>

Number of inserted rows.

Type Parameters

TSource

Source query record type.

InsertFirst<TSource>(IMultiInsertElse<TSource>)

Inserts source data into the first matching condition.

public static int InsertFirst<TSource>(this MultiInsertExtensions.IMultiInsertElse<TSource> insert)

Parameters

insert MultiInsertExtensions.IMultiInsertElse<TSource>

Multi-table insert to perform.

Returns

int

Number of inserted rows.

Type Parameters

TSource

Source query record type.

Insert<TSource>(IMultiInsertInto<TSource>)

Inserts source data into every configured table.

public static int Insert<TSource>(this MultiInsertExtensions.IMultiInsertInto<TSource> insert)

Parameters

insert MultiInsertExtensions.IMultiInsertInto<TSource>

Multi-table insert to perform.

Returns

int

Number of inserted rows.

Type Parameters

TSource

Source query record type.

Into<TSource, TTarget>(IMultiInsertInto<TSource>, ITable<TTarget>, Expression<Func<TSource, TTarget>>)

Unconditionally insert into target table.

public static MultiInsertExtensions.IMultiInsertInto<TSource> Into<TSource, TTarget>(this MultiInsertExtensions.IMultiInsertInto<TSource> source, ITable<TTarget> target, Expression<Func<TSource, TTarget>> setter) where TTarget : notnull

Parameters

source MultiInsertExtensions.IMultiInsertInto<TSource>

Source query, that returns data for insert operation.

target ITable<TTarget>

Target table to insert into.

setter Expression<Func<TSource, TTarget>>

Update expression. Uses record from source query as parameter. Expression supports only target table record new expression with field initializers.

Returns

MultiInsertExtensions.IMultiInsertInto<TSource>

Type Parameters

TSource

Source query record type.

TTarget

Target table record type.

MultiInsert<TSource>(IQueryable<TSource>)

Inserts records from source query into multiple target tables.

public static MultiInsertExtensions.IMultiInsertSource<TSource> MultiInsert<TSource>(this IQueryable<TSource> source)

Parameters

source IQueryable<TSource>

Source query, that returns data for insert operation.

Returns

MultiInsertExtensions.IMultiInsertSource<TSource>

Type Parameters

TSource

Source query record type.

Remarks

Only supported by Oracle data provider.

When<TSource, TTarget>(IMultiInsertWhen<TSource>, Expression<Func<TSource, bool>>, ITable<TTarget>, Expression<Func<TSource, TTarget>>)

Conditionally insert into target table.

public static MultiInsertExtensions.IMultiInsertWhen<TSource> When<TSource, TTarget>(this MultiInsertExtensions.IMultiInsertWhen<TSource> source, Expression<Func<TSource, bool>> condition, ITable<TTarget> target, Expression<Func<TSource, TTarget>> setter) where TTarget : notnull

Parameters

source MultiInsertExtensions.IMultiInsertWhen<TSource>

Source query, that returns data for insert operation.

condition Expression<Func<TSource, bool>>

Predicate indicating when to insert into target table.

target ITable<TTarget>

Target table to insert into.

setter Expression<Func<TSource, TTarget>>

Update expression. Uses record from source query as parameter. Expression supports only target table record new expression with field initializers.

Returns

MultiInsertExtensions.IMultiInsertWhen<TSource>

Type Parameters

TSource

Source query record type.

TTarget

Target table record type.