Class DataProviderBase
- Namespace
- LinqToDB.DataProvider
- Assembly
- linq2db.dll
public abstract class DataProviderBase : IDataProvider
- Inheritance
-
DataProviderBase
- Implements
- Derived
- Extension Methods
Constructors
DataProviderBase(string, MappingSchema)
protected DataProviderBase(string name, MappingSchema mappingSchema)
Parameters
name
stringmappingSchema
MappingSchema
Fields
ReaderExpressions
public readonly ConcurrentDictionary<ReaderInfo, Expression> ReaderExpressions
Field Value
Properties
ConnectionNamespace
public abstract string? ConnectionNamespace { get; }
Property Value
DataReaderType
public abstract Type DataReaderType { get; }
Property Value
ID
public int ID { get; }
Property Value
MappingSchema
public virtual MappingSchema MappingSchema { get; }
Property Value
Name
public string Name { get; }
Property Value
OnConnectionCreated
public static Func<IDataProvider, DbConnection, DbConnection>? OnConnectionCreated { get; set; }
Property Value
SqlProviderFlags
public SqlProviderFlags SqlProviderFlags { get; }
Property Value
SupportedTableOptions
public abstract TableOptions SupportedTableOptions { get; }
Property Value
TransactionsSupported
public virtual bool TransactionsSupported { get; }
Property Value
Methods
BulkCopyAsync<T>(DataOptions, ITable<T>, IEnumerable<T>, CancellationToken)
public virtual Task<BulkCopyRowsCopied> BulkCopyAsync<T>(DataOptions options, ITable<T> table, IEnumerable<T> source, CancellationToken cancellationToken) where T : notnull
Parameters
options
DataOptionstable
ITable<T>source
IEnumerable<T>cancellationToken
CancellationToken
Returns
Type Parameters
T
BulkCopy<T>(DataOptions, ITable<T>, IEnumerable<T>)
public virtual BulkCopyRowsCopied BulkCopy<T>(DataOptions options, ITable<T> table, IEnumerable<T> source) where T : notnull
Parameters
options
DataOptionstable
ITable<T>source
IEnumerable<T>
Returns
Type Parameters
T
ClearCommandParameters(DbCommand)
public virtual void ClearCommandParameters(DbCommand command)
Parameters
command
DbCommand
ConvertParameterType(Type, DbDataType)
public virtual Type ConvertParameterType(Type type, DbDataType dataType)
Parameters
type
TypedataType
DbDataType
Returns
CreateConnection(string)
public DbConnection CreateConnection(string connectionString)
Parameters
connectionString
string
Returns
CreateConnectionInternal(string)
protected abstract DbConnection CreateConnectionInternal(string connectionString)
Parameters
connectionString
string
Returns
CreateSqlBuilder(MappingSchema, DataOptions)
public abstract ISqlBuilder CreateSqlBuilder(MappingSchema mappingSchema, DataOptions dataOptions)
Parameters
mappingSchema
MappingSchemadataOptions
DataOptions
Returns
DisposeCommand(DbCommand)
public virtual void DisposeCommand(DbCommand command)
Parameters
command
DbCommand
ExecuteScope(DataConnection)
Creates disposable object, which should be disposed by caller after database query execution completed. Could be used to execute provider's method with scope-specific settings, e.g. with Invariant culture to workaround incorrect culture handling in provider.
public virtual IExecutionScope? ExecuteScope(DataConnection dataConnection)
Parameters
dataConnection
DataConnectionCurrent data connection object.
Returns
- IExecutionScope
Scoped execution disposable object or
null
if provider doesn't need scoped configuration.
FindExpression(ReaderInfo, out Expression?)
protected bool FindExpression(ReaderInfo info, out Expression? expr)
Parameters
info
ReaderInfoexpr
Expression
Returns
GetCommandBehavior(CommandBehavior)
public virtual CommandBehavior GetCommandBehavior(CommandBehavior commandBehavior)
Parameters
commandBehavior
CommandBehavior
Returns
GetConnectionInfo(DataConnection, string)
public virtual object? GetConnectionInfo(DataConnection dataConnection, string parameterName)
Parameters
dataConnection
DataConnectionparameterName
string
Returns
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
public virtual IQueryParametersNormalizer GetQueryParameterNormalizer()
Returns
GetReaderExpression(DbDataReader, int, Expression, Type?)
public virtual Expression GetReaderExpression(DbDataReader reader, int idx, Expression readerExpression, Type? toType)
Parameters
reader
DbDataReaderidx
intreaderExpression
ExpressiontoType
Type
Returns
GetSchemaProvider()
public abstract ISchemaProvider GetSchemaProvider()
Returns
GetSqlOptimizer(DataOptions)
public abstract ISqlOptimizer GetSqlOptimizer(DataOptions dataOptions)
Parameters
dataOptions
DataOptions
Returns
InitCommand(DataConnection, DbCommand, CommandType, string, DataParameter[]?, bool)
Initializes DataConnection command object.
public virtual DbCommand InitCommand(DataConnection dataConnection, DbCommand command, CommandType commandType, string commandText, DataParameter[]? parameters, bool withParameters)
Parameters
dataConnection
DataConnectionData connection instance to initialize with new command.
command
DbCommandCommand instance to initialize.
commandType
CommandTypeType of command.
commandText
stringCommand SQL.
parameters
DataParameter[]Optional list of parameters to add to initialized command.
withParameters
boolFlag 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)
public virtual void InitContext(IDataContext dataContext)
Parameters
dataContext
IDataContext
IsDBNullAllowed(DataOptions, DbDataReader, int)
public virtual bool? IsDBNullAllowed(DataOptions options, DbDataReader reader, int idx)
Parameters
options
DataOptionsreader
DbDataReaderidx
int
Returns
- bool?
NormalizeTypeName(string?)
protected virtual string? NormalizeTypeName(string? typeName)
Parameters
typeName
string
Returns
SetCharField(string, Expression<Func<DbDataReader, int, string>>)
protected void SetCharField(string dataTypeName, Expression<Func<DbDataReader, int, string>> expr)
Parameters
dataTypeName
stringexpr
Expression<Func<DbDataReader, int, string>>
SetCharFieldToType<T>(string, Expression<Func<DbDataReader, int, string>>)
protected void SetCharFieldToType<T>(string dataTypeName, Expression<Func<DbDataReader, int, string>> expr)
Parameters
dataTypeName
stringexpr
Expression<Func<DbDataReader, int, string>>
Type Parameters
T
SetField<TP, T>(Expression<Func<TP, int, T>>)
protected void SetField<TP, T>(Expression<Func<TP, int, T>> expr)
Parameters
expr
Expression<Func<TP, int, T>>
Type Parameters
TP
T
SetField<TP, T>(string, Expression<Func<TP, int, T>>)
protected void SetField<TP, T>(string dataTypeName, Expression<Func<TP, int, T>> expr)
Parameters
dataTypeName
stringexpr
Expression<Func<TP, int, T>>
Type Parameters
TP
T
SetField<TP, T>(string, Type, Expression<Func<TP, int, T>>)
protected void SetField<TP, T>(string dataTypeName, Type fieldType, Expression<Func<TP, int, T>> expr)
Parameters
dataTypeName
stringfieldType
Typeexpr
Expression<Func<TP, int, T>>
Type Parameters
TP
T
SetParameter(DataConnection, DbParameter, string, DbDataType, object?)
public virtual void SetParameter(DataConnection dataConnection, DbParameter parameter, string name, DbDataType dataType, object? value)
Parameters
dataConnection
DataConnectionparameter
DbParametername
stringdataType
DbDataTypevalue
object
SetParameterType(DataConnection, DbParameter, DbDataType)
protected virtual void SetParameterType(DataConnection dataConnection, DbParameter parameter, DbDataType dataType)
Parameters
dataConnection
DataConnectionparameter
DbParameterdataType
DbDataType
SetProviderField<TP, T>(Expression<Func<TP, int, T>>)
protected void SetProviderField<TP, T>(Expression<Func<TP, int, T>> expr)
Parameters
expr
Expression<Func<TP, int, T>>
Type Parameters
TP
T
SetProviderField<TP, T, TS>(Expression<Func<TP, int, T>>)
protected void SetProviderField<TP, T, TS>(Expression<Func<TP, int, T>> expr)
Parameters
expr
Expression<Func<TP, int, T>>
Type Parameters
TP
T
TS
SetToType<TP, T, TF>(Expression<Func<TP, int, T>>)
protected void SetToType<TP, T, TF>(Expression<Func<TP, int, T>> expr)
Parameters
expr
Expression<Func<TP, int, T>>
Type Parameters
TP
T
TF
SetToType<TP, T, TF>(string, Expression<Func<TP, int, T>>)
protected void SetToType<TP, T, TF>(string dataTypeName, Expression<Func<TP, int, T>> expr)
Parameters
dataTypeName
stringexpr
Expression<Func<TP, int, T>>
Type Parameters
TP
T
TF