Interface IDatabaseAdapter
Represents an adapter that adapts DbConnectionPlus to a specific database system.
Namespace: RentADeveloper.DbConnectionPlus.DatabaseAdapters
Assembly: RentADeveloper.DbConnectionPlus.dll
Syntax
public interface IDatabaseAdapter
Properties
View SourceEntityManipulator
The entity manipulator for the database system this adapter supports.
Declaration
IEntityManipulator EntityManipulator { get; }
Property Value
| Type | Description |
|---|---|
| IEntityManipulator |
TemporaryTableBuilder
The temporary table builder for the database system this adapter supports.
Declaration
ITemporaryTableBuilder TemporaryTableBuilder { get; }
Property Value
| Type | Description |
|---|---|
| ITemporaryTableBuilder |
Methods
View SourceBindParameterValue(DbParameter, object?)
Binds value to parameter.
If value is an Enum value, it is serialized according to the setting
EnumSerializationMode before being assigned to the parameter.
Declaration
void BindParameterValue(DbParameter parameter, object? value)
Parameters
| Type | Name | Description |
|---|---|---|
| DbParameter | parameter | The parameter to bind |
| object | value | The value to bind to |
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException |
|
FormatParameterName(string)
Returns parameterName with the appropriate prefix
(e.g. "@" for SQL Server or ":" for Oracle) for use in SQL statements.
Declaration
string FormatParameterName(string parameterName)
Parameters
| Type | Name | Description |
|---|---|---|
| string | parameterName | The parameter name to format. |
Returns
| Type | Description |
|---|---|
| string |
|
GetDataType(Type, EnumSerializationMode)
Gets the corresponding database specific data type for the type type.
Declaration
string GetDataType(Type type, EnumSerializationMode enumSerializationMode)
Parameters
| Type | Name | Description |
|---|---|---|
| Type | type | The type to get the database specific data type for. |
| EnumSerializationMode | enumSerializationMode | The mode to use to serialize Enum values. |
Returns
| Type | Description |
|---|---|
| string | The corresponding database specific data type for the type |
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException |
|
| ArgumentOutOfRangeException |
value. type could not be mapped to a database specific data type.
|
QuoteIdentifier(string)
Returns identifier properly quoted for use in SQL statements.
Declaration
string QuoteIdentifier(string identifier)
Parameters
| Type | Name | Description |
|---|---|---|
| string | identifier | The identifier to be quoted. |
Returns
| Type | Description |
|---|---|
| string | A string containing the quoted version of |
QuoteTemporaryTableName(string, DbConnection)
Returns the specified name of a temporary table properly quoted for use in SQL statements.
Declaration
string QuoteTemporaryTableName(string tableName, DbConnection connection)
Parameters
| Type | Name | Description |
|---|---|---|
| string | tableName | The temporary table name to quote. |
| DbConnection | connection | The database connection to use for quoting. |
Returns
| Type | Description |
|---|---|
| string | A string containing the quoted version of |
SupportsTemporaryTables(DbConnection)
Determines whether the database system this adapter supports has support for (local/session scoped) temporary tables.
Declaration
bool SupportsTemporaryTables(DbConnection connection)
Parameters
| Type | Name | Description |
|---|---|---|
| DbConnection | connection | The database connection to use to check for the support. |
Returns
| Type | Description |
|---|---|
| bool | true if the database system supports temporary tables; otherwise, false. |
Remarks
A database adapter returning true for this method must implement an ITemporaryTableBuilder and provide an instance of it via the TemporaryTableBuilder property.
If a database adapter returns false for this method, it must throw a NotSupportedException from the TemporaryTableBuilder property.
WasSqlStatementCancelledByCancellationToken(Exception, CancellationToken)
Determines whether exception was thrown because an SQL statement was cancelled via
cancellationToken.
Declaration
bool WasSqlStatementCancelledByCancellationToken(Exception exception, CancellationToken cancellationToken)
Parameters
| Type | Name | Description |
|---|---|---|
| Exception | exception | The exception to inspect. |
| CancellationToken | cancellationToken | The token via the SQL statement may have been cancelled. |
Returns
| Type | Description |
|---|---|
| bool | true if |
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException |
|