Table of Contents

Interface IDataProvider

Namespace
LinqToDB.DataProvider
Assembly
linq2db.dll
public interface IDataProvider
Extension Methods

Properties

ConnectionNamespace

string? ConnectionNamespace { get; }

Property Value

string

DataReaderType

Type DataReaderType { get; }

Property Value

Type

ID

int ID { get; }

Property Value

int

MappingSchema

MappingSchema MappingSchema { get; }

Property Value

MappingSchema

Name

string Name { get; }

Property Value

string

SqlProviderFlags

SqlProviderFlags SqlProviderFlags { get; }

Property Value

SqlProviderFlags

SupportedTableOptions

TableOptions SupportedTableOptions { get; }

Property Value

TableOptions

TransactionsSupported

bool TransactionsSupported { get; }

Property Value

bool

Methods

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

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

Parameters

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

Returns

Task<BulkCopyRowsCopied>

Type Parameters

T

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

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

Parameters

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

Returns

BulkCopyRowsCopied

Type Parameters

T

ConvertParameterType(Type, DbDataType)

Type ConvertParameterType(Type type, DbDataType dataType)

Parameters

type Type
dataType DbDataType

Returns

Type

CreateConnection(string)

DbConnection CreateConnection(string connectionString)

Parameters

connectionString string

Returns

DbConnection

CreateSqlBuilder(MappingSchema, DataOptions)

ISqlBuilder CreateSqlBuilder(MappingSchema mappingSchema, DataOptions dataOptions)

Parameters

mappingSchema MappingSchema
dataOptions DataOptions

Returns

ISqlBuilder

DisposeCommand(DbCommand)

void DisposeCommand(DbCommand command)

Parameters

command DbCommand

ExecuteScope(DataConnection)

Returns scoped context object to wrap calls of Execute* methods. Using this, provider could e.g. change thread culture during Execute* calls. Following calls wrapped right now: DataConnection.ExecuteNonQuery DataConnection.ExecuteReader.

IExecutionScope? ExecuteScope(DataConnection dataConnection)

Parameters

dataConnection DataConnection

Data connection instance used with scope.

Returns

IExecutionScope

Returns disposable scope object. Can be null.

GetCommandBehavior(CommandBehavior)

CommandBehavior GetCommandBehavior(CommandBehavior commandBehavior)

Parameters

commandBehavior CommandBehavior

Returns

CommandBehavior

GetConnectionInfo(DataConnection, string)

object? GetConnectionInfo(DataConnection dataConnection, string parameterName)

Parameters

dataConnection DataConnection
parameterName string

Returns

object

GetQueryParameterNormalizer()

Returns instance of IQueryParametersNormalizer, which implements normalization logic for parameters of single query. E.g. it could include:

  • trimming names that are too long
  • removing/replacing unsupported characters
  • name deduplication for parameters with same name
. For implementation without state it is recommended to return static instance. E.g. this could be done for providers with positional parameters that ignore names.
IQueryParametersNormalizer GetQueryParameterNormalizer()

Returns

IQueryParametersNormalizer

GetReaderExpression(DbDataReader, int, Expression, Type)

Expression GetReaderExpression(DbDataReader reader, int idx, Expression readerExpression, Type toType)

Parameters

reader DbDataReader
idx int
readerExpression Expression
toType Type

Returns

Expression

GetSchemaProvider()

ISchemaProvider GetSchemaProvider()

Returns

ISchemaProvider

GetSqlOptimizer(DataOptions)

ISqlOptimizer GetSqlOptimizer(DataOptions dataOptions)

Parameters

dataOptions DataOptions

Returns

ISqlOptimizer

InitCommand(DataConnection, DbCommand, CommandType, string, DataParameter[]?, bool)

Initializes DataConnection command object.

DbCommand InitCommand(DataConnection dataConnection, DbCommand command, CommandType commandType, string commandText, DataParameter[]? parameters, bool withParameters)

Parameters

dataConnection DataConnection

Data connection instance to initialize with new command.

command DbCommand

Command instance to initialize.

commandType CommandType

Type of command.

commandText string

Command SQL.

parameters DataParameter[]

Optional list of parameters to add to initialized command.

withParameters bool

Flag to indicate that command has parameters. Used to configure parameters support when method called without parameters and parameters added later to command.

Returns

DbCommand

Initialized command instance.

InitContext(IDataContext)

void InitContext(IDataContext dataContext)

Parameters

dataContext IDataContext

IsDBNullAllowed(DataOptions, DbDataReader, int)

bool? IsDBNullAllowed(DataOptions options, DbDataReader reader, int idx)

Parameters

options DataOptions
reader DbDataReader
idx int

Returns

bool?

SetParameter(DataConnection, DbParameter, string, DbDataType, object?)

void SetParameter(DataConnection dataConnection, DbParameter parameter, string name, DbDataType dataType, object? value)

Parameters

dataConnection DataConnection
parameter DbParameter
name string
dataType DbDataType
value object