Skip to content

IDatabaseMethods ​

Namespace: MJCZone.DapperMatic.Interfaces

Assembly: MJCZone.DapperMatic

Summary ​

Defines methods for interacting with a database.

Inheritance ​

Implemented Interfaces:

abstract public

Note: This is an interface that defines a contract. Look for implementing classes in the same or related namespaces.

Contents ​

Methods (7) | Properties (3)

Methods ​

MethodSummary
SupportsCheckConstraintsAsyncDetermines whether the database supports check constraints.
SupportsOrderedKeysInConstraintsAsyncDetermines whether the database supports ordered keys in constraints.
GetDatabaseVersionAsyncGets the version of the database.
GetDotnetTypeFromSqlTypeGets the .NET type descriptor from the SQL type.
GetSqlTypeFromDotnetTypeGets the SQL type from the .NET type descriptor.
GetAvailableDataTypesGets the available data types for this database provider.
DiscoverCustomDataTypesAsyncDiscovers custom data types from the database (e.g., user-defined types, domains, enums).

SupportsCheckConstraintsAsync ​

Determines whether the database supports check constraints.

csharp
Task<bool> SupportsCheckConstraintsAsync(
    IDbConnection db,
    IDbTransaction tx,
    CancellationToken cancellationToken)

Parameters ​

  • db (IDbConnection) - The database connection.
  • tx (IDbTransaction) - The database transaction.
  • cancellationToken (CancellationToken) - The cancellation token.

Returns ​

Type: Task<bool>

A task that represents the asynchronous operation. The task result contains a boolean indicating support for check constraints.

SupportsOrderedKeysInConstraintsAsync ​

Determines whether the database supports ordered keys in constraints.

csharp
Task<bool> SupportsOrderedKeysInConstraintsAsync(
    IDbConnection db,
    IDbTransaction tx,
    CancellationToken cancellationToken)

Parameters ​

  • db (IDbConnection) - The database connection.
  • tx (IDbTransaction) - The database transaction.
  • cancellationToken (CancellationToken) - The cancellation token.

Returns ​

Type: Task<bool>

A task that represents the asynchronous operation. The task result contains a boolean indicating support for ordered keys in constraints.

GetDatabaseVersionAsync ​

Gets the version of the database.

csharp
Task<Version> GetDatabaseVersionAsync(
    IDbConnection db,
    IDbTransaction tx,
    CancellationToken cancellationToken)

Parameters ​

  • db (IDbConnection) - The database connection.
  • tx (IDbTransaction) - The database transaction.
  • cancellationToken (CancellationToken) - The cancellation token.

Returns ​

Type: Task<Version>

A task that represents the asynchronous operation. The task result contains the database version.

GetDotnetTypeFromSqlType ​

Gets the .NET type descriptor from the SQL type.

csharp
DotnetTypeDescriptor GetDotnetTypeFromSqlType(string sqlType)

Parameters ​

  • sqlType (string) - The SQL type.

Returns ​

Type: DotnetTypeDescriptor

The .NET type descriptor.

GetSqlTypeFromDotnetType ​

Gets the SQL type from the .NET type descriptor.

csharp
string GetSqlTypeFromDotnetType(DotnetTypeDescriptor descriptor)

Parameters ​

Returns ​

Type: string

The SQL type.

GetAvailableDataTypes ​

Gets the available data types for this database provider.

csharp
IEnumerable<DataTypeInfo> GetAvailableDataTypes(bool includeAdvanced)

Parameters ​

  • includeAdvanced (bool) - If true, includes advanced/specialized types; otherwise, only common types.

Returns ​

Type: IEnumerable<DataTypeInfo>

A collection of available data types.

DiscoverCustomDataTypesAsync ​

Discovers custom data types from the database (e.g., user-defined types, domains, enums).

csharp
Task&lt;IEnumerable&lt;DataTypeInfo&gt;&gt; DiscoverCustomDataTypesAsync(
    IDbConnection db,
    IDbTransaction tx,
    CancellationToken cancellationToken)

Parameters ​

  • db (IDbConnection) - The database connection.
  • tx (IDbTransaction) - The database transaction.
  • cancellationToken (CancellationToken) - The cancellation token.

Returns ​

Type: Task<IEnumerable<DataTypeInfo>>

A task that represents the asynchronous operation. The task result contains custom data types.

Properties ​

ProviderType ​

Gets the type of the database provider.

Type: DbProviderType

ProviderTypeMap ​

Gets the provider type map.

Type: IDbProviderTypeMap

SupportsSchemas ​

Gets a value indicating whether the database supports schemas.

Type: bool