Interface IDatabaseAdapter
- Assembly
- RentADeveloper.DbConnectionPlus.dll
Represents an adapter that adapts DbConnectionPlus to a specific database system.
public interface IDatabaseAdapter
Properties
EntityManipulator
The entity manipulator for the database system this adapter supports.
IEntityManipulator EntityManipulator { get; }
Property Value
TemporaryTableBuilder
The temporary table builder for the database system this adapter supports.
ITemporaryTableBuilder TemporaryTableBuilder { get; }
Property Value
Methods
BindParameterValue(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.
void BindParameterValue(DbParameter parameter, object? value)
Parameters
parameterDbParameterThe parameter to bind
valueto.valueobjectThe value to bind to
parameter.
Exceptions
- ArgumentNullException
parameteris null.
FormatParameterName(string)
Returns parameterName with the appropriate prefix
(e.g. "@" for SQL Server or ":" for Oracle) for use in SQL statements.
string FormatParameterName(string parameterName)
Parameters
parameterNamestringThe parameter name to format.
Returns
- string
parameterNameformatted with the appropriate prefix, suitable for inclusion in SQL statements.
GetDataType(Type, EnumSerializationMode)
Gets the corresponding database specific data type for the type type.
string GetDataType(Type type, EnumSerializationMode enumSerializationMode)
Parameters
typeTypeThe type to get the database specific data type for.
enumSerializationModeEnumSerializationModeThe mode to use to serialize Enum values.
Returns
- string
The corresponding database specific data type for the type
type.
Exceptions
- ArgumentNullException
typeis null.- ArgumentOutOfRangeException
-
enumSerializationModeis not a valid EnumSerializationMode value. -
The type
typecould not be mapped to a database specific data type.
-
QuoteIdentifier(string)
Returns identifier properly quoted for use in SQL statements.
string QuoteIdentifier(string identifier)
Parameters
identifierstringThe identifier to be quoted.
Returns
- string
A string containing the quoted version of
identifier, suitable for use in SQL statements.
QuoteTemporaryTableName(string, DbConnection)
Returns the specified name of a temporary table properly quoted for use in SQL statements.
string QuoteTemporaryTableName(string tableName, DbConnection connection)
Parameters
tableNamestringThe temporary table name to quote.
connectionDbConnectionThe database connection to use for quoting.
Returns
- string
A string containing the quoted version of
tableName, suitable for use in SQL statements.
SupportsTemporaryTables(DbConnection)
Determines whether the database system this adapter supports has support for (local/session scoped) temporary tables.
bool SupportsTemporaryTables(DbConnection connection)
Parameters
connectionDbConnectionThe database connection to use to check for the support.
Returns
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.
bool WasSqlStatementCancelledByCancellationToken(Exception exception, CancellationToken cancellationToken)
Parameters
exceptionExceptionThe exception to inspect.
cancellationTokenCancellationTokenThe token via the SQL statement may have been cancelled.
Returns
- bool
true if
exceptionwas thrown because an SQL statement was cancelled viacancellationToken; otherwise, false.
Exceptions
- ArgumentNullException
exceptionis null.