Class AdbSqlClientTypeMapper
Stores mappings between .NET types and database types, and allows setting the database type of database parameters from these mappings.
This class adds mappings for SQL Server® Microsoft.Data.SqlClient database types. See the
Data Type Mappings
, as well as AdbTypeMapper and
predefined type mappings
for further details.
This class can be derived from to create a customized provider that revises and adds mappings.
This class is immutable. This avoids threading issues, since an instance is often accessed by multiple threads. Any user custom provider services should also be immutable for the same reason.
Implements
Inherited Members
Namespace: actionETL.Adb.SqlClientExternal
Assembly: actionETL.dll
Syntax
public class AdbSqlClientTypeMapper : AdbTypeMapper, IAdbTypeMapper
Constructors
AdbSqlClientTypeMapper()
Initializes a new instance of the AdbSqlClientTypeMapper class,
which stores SQL Server® Microsoft.Data.SqlClient mappings between .NET types and
database types, and allows setting the database type of database parameters from
these mappings.
Declaration
public AdbSqlClientTypeMapper()
Methods
Get()
Gets a singleton instance of AdbSqlClientTypeMapper, which is used when instantiating a new AdbProvider for accessing a SQL Server® data source.
Declaration
public static IAdbTypeMapper Get()
Returns
| Type | Description |
|---|---|
| IAdbTypeMapper |
SetMappedType(AdbParameter, Type, AdbColumnSchema, ParameterDirection)
Set the database type of a database parameter, using previously defined mappings.
The database type can be provider-independent such as System.Data.DbType
Int32, or a provider-specific one such as
System.Data.SqlDbType UniqueIdentifier, or Untyped, which means
the provider deduces the database type for each value, e.g. for each row.
If no pre-defined mapping is found, and dotNetType is an enum or
nullable enum, and adbColumnSchema is either null or an
integral type, then the parameter is mapped to the enum underlying type.
This allows the enum to be stored in an integer column.
Declaration
public override bool SetMappedType(AdbParameter adbParameter, Type dotNetType, AdbColumnSchema adbColumnSchema, ParameterDirection direction)
Parameters
| Type | Name | Description |
|---|---|---|
| AdbParameter | adbParameter | The database parameter. Must not be |
| Type | dotNetType | The .NET CLR type ( |
| AdbColumnSchema | adbColumnSchema | The schema for the database column, or null if not available. |
| ParameterDirection | direction | The parameter direction. |
Returns
| Type | Description |
|---|---|
| Boolean |
|
Overrides
Exceptions
| Type | Condition |
|---|---|
| ArgumentException |
|
| ArgumentNullException |
|