Table of Contents

Class BasicBulkCopy

Namespace
LinqToDB.Internal.DataProvider
Assembly
linq2db.dll
public class BasicBulkCopy
Inheritance
object
BasicBulkCopy
Derived
Extension Methods

Properties

CastAllRowsParametersOnUnionAll

protected virtual bool CastAllRowsParametersOnUnionAll { get; }

Property Value

bool

CastFirstRowLiteralOnUnionAll

protected virtual bool CastFirstRowLiteralOnUnionAll { get; }

Property Value

bool

CastFirstRowParametersOnUnionAll

protected virtual bool CastFirstRowParametersOnUnionAll { get; }

Property Value

bool

MaxMultipleRows

protected virtual int? MaxMultipleRows { get; }

Property Value

int?

MaxParameters

protected virtual int MaxParameters { get; }

Property Value

int

MaxSqlLength

protected virtual int MaxSqlLength { get; }

Property Value

int

MultipleRowsConvertToParameter

protected virtual Func<DataOptions, DbDataType, object?, bool>? MultipleRowsConvertToParameter { get; }

Property Value

Func<DataOptions, DbDataType, object, bool>

Methods

BulkCopyAsync<T>(BulkCopyType, ITable<T>, DataOptions, IAsyncEnumerable<T>, CancellationToken)

public virtual Task<BulkCopyRowsCopied> BulkCopyAsync<T>(BulkCopyType bulkCopyType, ITable<T> table, DataOptions options, IAsyncEnumerable<T> source, CancellationToken cancellationToken) where T : notnull

Parameters

bulkCopyType BulkCopyType
table ITable<T>
options DataOptions
source IAsyncEnumerable<T>
cancellationToken CancellationToken

Returns

Task<BulkCopyRowsCopied>

Type Parameters

T

BulkCopyAsync<T>(BulkCopyType, ITable<T>, DataOptions, IEnumerable<T>, CancellationToken)

public virtual Task<BulkCopyRowsCopied> BulkCopyAsync<T>(BulkCopyType bulkCopyType, ITable<T> table, DataOptions options, IEnumerable<T> source, CancellationToken cancellationToken) where T : notnull

Parameters

bulkCopyType BulkCopyType
table ITable<T>
options DataOptions
source IEnumerable<T>
cancellationToken CancellationToken

Returns

Task<BulkCopyRowsCopied>

Type Parameters

T

BulkCopy<T>(BulkCopyType, ITable<T>, DataOptions, IEnumerable<T>)

public virtual BulkCopyRowsCopied BulkCopy<T>(BulkCopyType bulkCopyType, ITable<T> table, DataOptions options, IEnumerable<T> source) where T : notnull

Parameters

bulkCopyType BulkCopyType
table ITable<T>
options DataOptions
source IEnumerable<T>

Returns

BulkCopyRowsCopied

Type Parameters

T

CastLiteral(ColumnDescriptor)

protected virtual bool CastLiteral(ColumnDescriptor column)

Parameters

column ColumnDescriptor

Returns

bool

GetInsertInto(MultipleRowsHelper)

Returns the INSERT INTO {tableName} fragment used at the start of bulk INSERT statements in MultipleRows bulk copy mode. Override in provider-specific bulk copy classes to inject directives between INSERT and INTO, such as OR IGNORE.

protected virtual string GetInsertInto(MultipleRowsHelper helper)

Parameters

helper MultipleRowsHelper

Returns

string

GetMultipleRowsSuffix(BulkCopyOptions)

Returns an optional SQL suffix appended after the INSERT ... VALUES statement in MultipleRows bulk copy mode. Override in provider-specific bulk copy classes to append clauses such as ON CONFLICT DO NOTHING.

protected virtual string? GetMultipleRowsSuffix(BulkCopyOptions options)

Parameters

options BulkCopyOptions

Returns

string

GetTableName<T>(ISqlBuilder, BulkCopyOptions, ITable<T>, bool)

protected static string GetTableName<T>(ISqlBuilder sqlBuilder, BulkCopyOptions options, ITable<T> table, bool escaped = true) where T : notnull

Parameters

sqlBuilder ISqlBuilder
options BulkCopyOptions
table ITable<T>
escaped bool

Returns

string

Type Parameters

T

MultipleRowsCopy1(MultipleRowsHelper, IEnumerable)

protected BulkCopyRowsCopied MultipleRowsCopy1(MultipleRowsHelper helper, IEnumerable source)

Parameters

helper MultipleRowsHelper
source IEnumerable

Returns

BulkCopyRowsCopied

MultipleRowsCopy1Async(MultipleRowsHelper, IEnumerable, CancellationToken)

protected Task<BulkCopyRowsCopied> MultipleRowsCopy1Async(MultipleRowsHelper helper, IEnumerable source, CancellationToken cancellationToken)

Parameters

helper MultipleRowsHelper
source IEnumerable
cancellationToken CancellationToken

Returns

Task<BulkCopyRowsCopied>

MultipleRowsCopy1Async<T>(ITable<T>, DataOptions, IAsyncEnumerable<T>, CancellationToken)

protected Task<BulkCopyRowsCopied> MultipleRowsCopy1Async<T>(ITable<T> table, DataOptions options, IAsyncEnumerable<T> source, CancellationToken cancellationToken) where T : notnull

Parameters

table ITable<T>
options DataOptions
source IAsyncEnumerable<T>
cancellationToken CancellationToken

Returns

Task<BulkCopyRowsCopied>

Type Parameters

T

MultipleRowsCopy1Async<T>(ITable<T>, DataOptions, IEnumerable<T>, CancellationToken)

protected Task<BulkCopyRowsCopied> MultipleRowsCopy1Async<T>(ITable<T> table, DataOptions options, IEnumerable<T> source, CancellationToken cancellationToken) where T : notnull

Parameters

table ITable<T>
options DataOptions
source IEnumerable<T>
cancellationToken CancellationToken

Returns

Task<BulkCopyRowsCopied>

Type Parameters

T

MultipleRowsCopy1Async<T>(MultipleRowsHelper, IAsyncEnumerable<T>, CancellationToken)

protected Task<BulkCopyRowsCopied> MultipleRowsCopy1Async<T>(MultipleRowsHelper helper, IAsyncEnumerable<T> source, CancellationToken cancellationToken) where T : notnull

Parameters

helper MultipleRowsHelper
source IAsyncEnumerable<T>
cancellationToken CancellationToken

Returns

Task<BulkCopyRowsCopied>

Type Parameters

T

MultipleRowsCopy1<T>(ITable<T>, DataOptions, IEnumerable<T>)

protected BulkCopyRowsCopied MultipleRowsCopy1<T>(ITable<T> table, DataOptions options, IEnumerable<T> source) where T : notnull

Parameters

table ITable<T>
options DataOptions
source IEnumerable<T>

Returns

BulkCopyRowsCopied

Type Parameters

T

MultipleRowsCopy2(MultipleRowsHelper, IEnumerable, string)

protected BulkCopyRowsCopied MultipleRowsCopy2(MultipleRowsHelper helper, IEnumerable source, string from)

Parameters

helper MultipleRowsHelper
source IEnumerable
from string

Returns

BulkCopyRowsCopied

MultipleRowsCopy2Async(MultipleRowsHelper, IEnumerable, string, CancellationToken)

protected Task<BulkCopyRowsCopied> MultipleRowsCopy2Async(MultipleRowsHelper helper, IEnumerable source, string from, CancellationToken cancellationToken)

Parameters

helper MultipleRowsHelper
source IEnumerable
from string
cancellationToken CancellationToken

Returns

Task<BulkCopyRowsCopied>

MultipleRowsCopy2Async<T>(ITable<T>, DataOptions, IAsyncEnumerable<T>, string, CancellationToken)

protected Task<BulkCopyRowsCopied> MultipleRowsCopy2Async<T>(ITable<T> table, DataOptions options, IAsyncEnumerable<T> source, string from, CancellationToken cancellationToken) where T : notnull

Parameters

table ITable<T>
options DataOptions
source IAsyncEnumerable<T>
from string
cancellationToken CancellationToken

Returns

Task<BulkCopyRowsCopied>

Type Parameters

T

MultipleRowsCopy2Async<T>(ITable<T>, DataOptions, IEnumerable<T>, string, CancellationToken)

protected Task<BulkCopyRowsCopied> MultipleRowsCopy2Async<T>(ITable<T> table, DataOptions options, IEnumerable<T> source, string from, CancellationToken cancellationToken) where T : notnull

Parameters

table ITable<T>
options DataOptions
source IEnumerable<T>
from string
cancellationToken CancellationToken

Returns

Task<BulkCopyRowsCopied>

Type Parameters

T

MultipleRowsCopy2Async<T>(MultipleRowsHelper, IAsyncEnumerable<T>, string, CancellationToken)

protected Task<BulkCopyRowsCopied> MultipleRowsCopy2Async<T>(MultipleRowsHelper helper, IAsyncEnumerable<T> source, string from, CancellationToken cancellationToken) where T : notnull

Parameters

helper MultipleRowsHelper
source IAsyncEnumerable<T>
from string
cancellationToken CancellationToken

Returns

Task<BulkCopyRowsCopied>

Type Parameters

T

MultipleRowsCopy2<T>(ITable<T>, DataOptions, IEnumerable<T>, string)

protected BulkCopyRowsCopied MultipleRowsCopy2<T>(ITable<T> table, DataOptions options, IEnumerable<T> source, string from) where T : notnull

Parameters

table ITable<T>
options DataOptions
source IEnumerable<T>
from string

Returns

BulkCopyRowsCopied

Type Parameters

T

MultipleRowsCopy3(MultipleRowsHelper, IEnumerable, string)

protected BulkCopyRowsCopied MultipleRowsCopy3(MultipleRowsHelper helper, IEnumerable source, string from)

Parameters

helper MultipleRowsHelper
source IEnumerable
from string

Returns

BulkCopyRowsCopied

MultipleRowsCopy3Async(MultipleRowsHelper, IEnumerable, string, CancellationToken)

protected Task<BulkCopyRowsCopied> MultipleRowsCopy3Async(MultipleRowsHelper helper, IEnumerable source, string from, CancellationToken cancellationToken)

Parameters

helper MultipleRowsHelper
source IEnumerable
from string
cancellationToken CancellationToken

Returns

Task<BulkCopyRowsCopied>

MultipleRowsCopy3Async<T>(MultipleRowsHelper, IAsyncEnumerable<T>, string, CancellationToken)

protected Task<BulkCopyRowsCopied> MultipleRowsCopy3Async<T>(MultipleRowsHelper helper, IAsyncEnumerable<T> source, string from, CancellationToken cancellationToken) where T : notnull

Parameters

helper MultipleRowsHelper
source IAsyncEnumerable<T>
from string
cancellationToken CancellationToken

Returns

Task<BulkCopyRowsCopied>

Type Parameters

T

MultipleRowsCopyAsync<T>(ITable<T>, DataOptions, IAsyncEnumerable<T>, CancellationToken)

protected virtual Task<BulkCopyRowsCopied> MultipleRowsCopyAsync<T>(ITable<T> table, DataOptions options, IAsyncEnumerable<T> source, CancellationToken cancellationToken) where T : notnull

Parameters

table ITable<T>
options DataOptions
source IAsyncEnumerable<T>
cancellationToken CancellationToken

Returns

Task<BulkCopyRowsCopied>

Type Parameters

T

MultipleRowsCopyAsync<T>(ITable<T>, DataOptions, IEnumerable<T>, CancellationToken)

protected virtual Task<BulkCopyRowsCopied> MultipleRowsCopyAsync<T>(ITable<T> table, DataOptions options, IEnumerable<T> source, CancellationToken cancellationToken) where T : notnull

Parameters

table ITable<T>
options DataOptions
source IEnumerable<T>
cancellationToken CancellationToken

Returns

Task<BulkCopyRowsCopied>

Type Parameters

T

MultipleRowsCopyHelper(MultipleRowsHelper, IEnumerable, string?, Action<MultipleRowsHelper>, Action<MultipleRowsHelper, object, string?>, Action<MultipleRowsHelper>, int, int)

protected static BulkCopyRowsCopied MultipleRowsCopyHelper(MultipleRowsHelper helper, IEnumerable source, string? from, Action<MultipleRowsHelper> prepFunction, Action<MultipleRowsHelper, object, string?> addFunction, Action<MultipleRowsHelper> finishFunction, int maxParameters, int maxSqlLength)

Parameters

helper MultipleRowsHelper
source IEnumerable
from string
prepFunction Action<MultipleRowsHelper>
addFunction Action<MultipleRowsHelper, object, string>
finishFunction Action<MultipleRowsHelper>
maxParameters int
maxSqlLength int

Returns

BulkCopyRowsCopied

MultipleRowsCopyHelperAsync(MultipleRowsHelper, IEnumerable, string?, Action<MultipleRowsHelper>, Action<MultipleRowsHelper, object, string?>, Action<MultipleRowsHelper>, CancellationToken, int, int)

protected static Task<BulkCopyRowsCopied> MultipleRowsCopyHelperAsync(MultipleRowsHelper helper, IEnumerable source, string? from, Action<MultipleRowsHelper> prepFunction, Action<MultipleRowsHelper, object, string?> addFunction, Action<MultipleRowsHelper> finishFunction, CancellationToken cancellationToken, int maxParameters, int maxSqlLength)

Parameters

helper MultipleRowsHelper
source IEnumerable
from string
prepFunction Action<MultipleRowsHelper>
addFunction Action<MultipleRowsHelper, object, string>
finishFunction Action<MultipleRowsHelper>
cancellationToken CancellationToken
maxParameters int
maxSqlLength int

Returns

Task<BulkCopyRowsCopied>

MultipleRowsCopyHelperAsync<T>(MultipleRowsHelper, IAsyncEnumerable<T>, string?, Action<MultipleRowsHelper>, Action<MultipleRowsHelper, object, string?>, Action<MultipleRowsHelper>, CancellationToken, int, int)

protected static Task<BulkCopyRowsCopied> MultipleRowsCopyHelperAsync<T>(MultipleRowsHelper helper, IAsyncEnumerable<T> source, string? from, Action<MultipleRowsHelper> prepFunction, Action<MultipleRowsHelper, object, string?> addFunction, Action<MultipleRowsHelper> finishFunction, CancellationToken cancellationToken, int maxParameters, int maxSqlLength)

Parameters

helper MultipleRowsHelper
source IAsyncEnumerable<T>
from string
prepFunction Action<MultipleRowsHelper>
addFunction Action<MultipleRowsHelper, object, string>
finishFunction Action<MultipleRowsHelper>
cancellationToken CancellationToken
maxParameters int
maxSqlLength int

Returns

Task<BulkCopyRowsCopied>

Type Parameters

T

MultipleRowsCopy<T>(ITable<T>, DataOptions, IEnumerable<T>)

protected virtual BulkCopyRowsCopied MultipleRowsCopy<T>(ITable<T> table, DataOptions options, IEnumerable<T> source) where T : notnull

Parameters

table ITable<T>
options DataOptions
source IEnumerable<T>

Returns

BulkCopyRowsCopied

Type Parameters

T

ProviderSpecificCopyAsync<T>(ITable<T>, DataOptions, IAsyncEnumerable<T>, CancellationToken)

protected virtual Task<BulkCopyRowsCopied> ProviderSpecificCopyAsync<T>(ITable<T> table, DataOptions options, IAsyncEnumerable<T> source, CancellationToken cancellationToken) where T : notnull

Parameters

table ITable<T>
options DataOptions
source IAsyncEnumerable<T>
cancellationToken CancellationToken

Returns

Task<BulkCopyRowsCopied>

Type Parameters

T

ProviderSpecificCopyAsync<T>(ITable<T>, DataOptions, IEnumerable<T>, CancellationToken)

protected virtual Task<BulkCopyRowsCopied> ProviderSpecificCopyAsync<T>(ITable<T> table, DataOptions options, IEnumerable<T> source, CancellationToken cancellationToken) where T : notnull

Parameters

table ITable<T>
options DataOptions
source IEnumerable<T>
cancellationToken CancellationToken

Returns

Task<BulkCopyRowsCopied>

Type Parameters

T

ProviderSpecificCopy<T>(ITable<T>, DataOptions, IEnumerable<T>)

protected virtual BulkCopyRowsCopied ProviderSpecificCopy<T>(ITable<T> table, DataOptions options, IEnumerable<T> source) where T : notnull

Parameters

table ITable<T>
options DataOptions
source IEnumerable<T>

Returns

BulkCopyRowsCopied

Type Parameters

T

RowByRowCopyAsync<T>(ITable<T>, DataOptions, IAsyncEnumerable<T>, CancellationToken)

protected virtual Task<BulkCopyRowsCopied> RowByRowCopyAsync<T>(ITable<T> table, DataOptions dataOptions, IAsyncEnumerable<T> source, CancellationToken cancellationToken) where T : notnull

Parameters

table ITable<T>
dataOptions DataOptions
source IAsyncEnumerable<T>
cancellationToken CancellationToken

Returns

Task<BulkCopyRowsCopied>

Type Parameters

T

RowByRowCopyAsync<T>(ITable<T>, DataOptions, IEnumerable<T>, CancellationToken)

protected virtual Task<BulkCopyRowsCopied> RowByRowCopyAsync<T>(ITable<T> table, DataOptions dataOptions, IEnumerable<T> source, CancellationToken cancellationToken) where T : notnull

Parameters

table ITable<T>
dataOptions DataOptions
source IEnumerable<T>
cancellationToken CancellationToken

Returns

Task<BulkCopyRowsCopied>

Type Parameters

T

RowByRowCopy<T>(ITable<T>, DataOptions, IEnumerable<T>)

protected BulkCopyRowsCopied RowByRowCopy<T>(ITable<T> table, DataOptions dataOptions, IEnumerable<T> source) where T : notnull

Parameters

table ITable<T>
dataOptions DataOptions
source IEnumerable<T>

Returns

BulkCopyRowsCopied

Type Parameters

T

TraceAction(DataConnection, Func<string>, Func<int>)

protected void TraceAction(DataConnection dataConnection, Func<string> commandText, Func<int> action)

Parameters

dataConnection DataConnection
commandText Func<string>
action Func<int>

TraceActionAsync(DataConnection, Func<string>, Func<Task<int>>)

protected Task TraceActionAsync(DataConnection dataConnection, Func<string> commandText, Func<Task<int>> action)

Parameters

dataConnection DataConnection
commandText Func<string>
action Func<Task<int>>

Returns

Task