Skip to content

DatabaseMethodsBase ​

Namespace: MJCZone.DapperMatic.Providers.Base

Assembly: MJCZone.DapperMatic

Summary ​

Represents the base class for database methods.

Inheritance ​

Implemented Interfaces:

abstract public

Note: This is an abstract base class. Concrete implementations can be found in provider-specific namespaces.

Contents ​

Methods (101) | Properties (4)

Methods ​

MethodSummary
DoesCheckConstraintExistAsyncChecks if a check constraint exists in the specified table.
DoesCheckConstraintExistOnColumnAsyncChecks if a check constraint exists on a specific column in the specified table.
CreateCheckConstraintIfNotExistsAsyncCreates a check constraint if it does not already exist.
CreateCheckConstraintIfNotExistsAsyncCreates a check constraint if it does not already exist.
GetCheckConstraintAsyncGets the details of a check constraint.
GetCheckConstraintNameOnColumnAsyncGets the name of a check constraint on a specific column.
GetCheckConstraintNamesAsyncGets the names of all check constraints in the specified table.
GetCheckConstraintOnColumnAsyncGets the details of a check constraint on a specific column.
GetCheckConstraintsAsyncGets the details of all check constraints in the specified table.
DropCheckConstraintOnColumnIfExistsAsyncDrops a check constraint on a specific column if it exists.
DropCheckConstraintIfExistsAsyncDrops a check constraint if it exists.
DoesColumnExistAsyncChecks if a column exists in the specified table.
CreateColumnIfNotExistsAsyncCreates a column if it does not already exist in the specified table.
CreateColumnIfNotExistsAsyncCreates a column with the specified properties if it does not already exist in the specified table.
GetColumnAsyncRetrieves a column from the specified table.
GetColumnNamesAsyncRetrieves the names of columns from the specified table.
GetColumnsAsyncRetrieves columns from the specified table.
DropColumnIfExistsAsyncDrops a column if it exists in the specified table.
RenameColumnIfExistsAsyncRenames a column if it exists in the specified table.
SupportsCheckConstraintsAsyncDetermines whether the provider supports check constraints.
SupportsOrderedKeysInConstraintsAsyncDetermines whether the provider supports ordered keys in constraints.
SupportsDefaultConstraintsAsyncDetermines whether the provider supports default constraints.
GetDotnetTypeFromSqlTypeGets the .NET type descriptor from the SQL type.
GetSqlTypeFromDotnetTypeGets the SQL type from the .NET type descriptor.
GetDatabaseVersionAsyncGets the database version asynchronously.
GetSchemaQualifiedIdentifierNameGets the schema-qualified identifier name.
DoesDefaultConstraintExistAsyncChecks if a default constraint exists in the database.
DoesDefaultConstraintExistOnColumnAsyncChecks if a default constraint exists on a specific column in the database.
CreateDefaultConstraintIfNotExistsAsyncCreates a default constraint if it does not exist.
CreateDefaultConstraintIfNotExistsAsyncCreates a default constraint if it does not exist.
GetDefaultConstraintAsyncGets a default constraint from the database.
GetDefaultConstraintNameOnColumnAsyncGets the name of the default constraint on a specific column.
GetDefaultConstraintNamesAsyncGets the names of all default constraints in the database.
GetDefaultConstraintOnColumnAsyncGets the default constraint on a specific column.
GetDefaultConstraintsAsyncGets all default constraints in the database.
DropDefaultConstraintOnColumnIfExistsAsyncDrops the default constraint on a specific column if it exists.
DropDefaultConstraintIfExistsAsyncDrops a default constraint if it exists.
DoesForeignKeyConstraintExistAsyncChecks if a foreign key constraint exists.
DoesForeignKeyConstraintExistOnColumnAsyncChecks if a foreign key constraint exists on a specific column.
CreateForeignKeyConstraintIfNotExistsAsyncCreates a foreign key constraint if it does not exist.
CreateForeignKeyConstraintIfNotExistsAsyncCreates a foreign key constraint if it does not exist.
GetForeignKeyConstraintAsyncGets a foreign key constraint.
GetForeignKeyConstraintNameOnColumnAsyncGets the name of the foreign key constraint on a specific column.
GetForeignKeyConstraintNamesAsyncGets the names of the foreign key constraints.
GetForeignKeyConstraintOnColumnAsyncGets the foreign key constraint on a specific column.
GetForeignKeyConstraintsAsyncGets the foreign key constraints.
DropForeignKeyConstraintOnColumnIfExistsAsyncDrops the foreign key constraint on a specific column if it exists.
DropForeignKeyConstraintIfExistsAsyncDrops the foreign key constraint if it exists.
DoesIndexExistAsyncChecks if an index exists in the database.
DoesIndexExistOnColumnAsyncChecks if an index exists on a specific column in the database.
CreateIndexIfNotExistsAsyncCreates an index if it does not already exist.
CreateIndexIfNotExistsAsyncCreates an index if it does not already exist.
GetIndexAsyncRetrieves an index from the database.
GetIndexesAsyncRetrieves a list of indexes from the database.
GetIndexNamesOnColumnAsyncRetrieves a list of index names on a specific column from the database.
GetIndexNamesAsyncRetrieves a list of index names from the database.
GetIndexesOnColumnAsyncRetrieves a list of indexes on a specific column from the database.
DropIndexIfExistsAsyncDrops an index if it exists in the database.
DropIndexesOnColumnIfExistsAsyncDrops indexes on a specific column if they exist in the database.
DoesPrimaryKeyConstraintExistAsyncChecks if a primary key constraint exists on the specified table.
CreatePrimaryKeyConstraintIfNotExistsAsyncCreates a primary key constraint if it does not already exist.
CreatePrimaryKeyConstraintIfNotExistsAsyncCreates a primary key constraint if it does not already exist.
GetPrimaryKeyConstraintAsyncGets the primary key constraint for the specified table.
DropPrimaryKeyConstraintIfExistsAsyncDrops the primary key constraint if it exists.
DoesSchemaExistAsyncChecks if a schema exists in the database.
CreateSchemaIfNotExistsAsyncCreates a schema if it does not exist in the database.
GetSchemaNamesAsyncRetrieves the list of schema names from the database.
DropSchemaIfExistsAsyncDrops a schema if it exists in the database.
DoesTableExistAsyncChecks if a table exists in the database.
CreateTablesIfNotExistsAsyncCreates tables if they do not exist.
CreateTableIfNotExistsAsyncCreates a table if it does not exist.
CreateTableIfNotExistsAsyncCreates a table if it does not exist.
GetTableAsyncGets a table from the database.
GetTableNamesAsyncGets the names of tables in the database.
GetTablesAsyncGets tables from the database.
DropTableIfExistsAsyncDrops a table if it exists.
RenameTableIfExistsAsyncRenames a table if it exists.
TruncateTableIfExistsAsyncTruncates a table if it exists.
DoesUniqueConstraintExistAsyncChecks if a unique constraint exists in the specified table.
DoesUniqueConstraintExistOnColumnAsyncChecks if a unique constraint exists on the specified column.
CreateUniqueConstraintIfNotExistsAsyncCreates a unique constraint if it does not already exist.
CreateUniqueConstraintIfNotExistsAsyncCreates a unique constraint if it does not already exist.
GetUniqueConstraintAsyncGets a unique constraint by name.
GetUniqueConstraintNameOnColumnAsyncGets the name of the unique constraint on the specified column.
GetUniqueConstraintNamesAsyncGets the names of all unique constraints in the specified table.
GetUniqueConstraintOnColumnAsyncGets the unique constraint on the specified column.
GetUniqueConstraintsAsyncGets all unique constraints in the specified table.
DropUniqueConstraintIfExistsAsyncDrops a unique constraint if it exists.
DropUniqueConstraintOnColumnIfExistsAsyncDrops a unique constraint on the specified column if it exists.
DoesViewExistAsyncChecks if a view exists in the database.
CreateViewIfNotExistsAsyncCreates a view if it does not exist.
CreateViewIfNotExistsAsyncCreates a view if it does not exist.
GetViewAsyncGets a view from the database.
GetViewNamesAsyncGets the names of views from the database.
GetViewsAsyncGets views from the database.
DropViewIfExistsAsyncDrops a view if it exists.
RenameViewIfExistsAsyncRenames a view if it exists.
GetType
ToString
Equals
GetHashCode

DoesCheckConstraintExistAsync ​

Checks if a check constraint exists in the specified table.

csharp
Task<bool> DoesCheckConstraintExistAsync(IDbConnection db, string schemaName, string tableName, string constraintName, IDbTransaction tx, CancellationToken cancellationToken)

Parameters ​

  • db (IDbConnection) - The database connection.
  • schemaName (string) - The schema name.
  • tableName (string) - The table name.
  • constraintName (string) - The constraint name.
  • tx (IDbTransaction) - The transaction.
  • cancellationToken (CancellationToken) - The cancellation token.

Returns ​

Type: Task<bool>

True if the check constraint exists, otherwise false.

DoesCheckConstraintExistOnColumnAsync ​

Checks if a check constraint exists on a specific column in the specified table.

csharp
Task<bool> DoesCheckConstraintExistOnColumnAsync(IDbConnection db, string schemaName, string tableName, string columnName, IDbTransaction tx, CancellationToken cancellationToken)

Parameters ​

  • db (IDbConnection) - The database connection.
  • schemaName (string) - The schema name.
  • tableName (string) - The table name.
  • columnName (string) - The column name.
  • tx (IDbTransaction) - The transaction.
  • cancellationToken (CancellationToken) - The cancellation token.

Returns ​

Type: Task<bool>

True if the check constraint exists on the column, otherwise false.

CreateCheckConstraintIfNotExistsAsync ​

Creates a check constraint if it does not already exist.

csharp
Task<bool> CreateCheckConstraintIfNotExistsAsync(IDbConnection db, DmCheckConstraint constraint, IDbTransaction tx, CancellationToken cancellationToken)

Parameters ​

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

Returns ​

Type: Task<bool>

True if the check constraint was created, otherwise false.

CreateCheckConstraintIfNotExistsAsync ​

Creates a check constraint if it does not already exist.

csharp
Task<bool> CreateCheckConstraintIfNotExistsAsync(IDbConnection db, string schemaName, string tableName, string columnName, string constraintName, string expression, IDbTransaction tx, CancellationToken cancellationToken)

Parameters ​

  • db (IDbConnection) - The database connection.
  • schemaName (string) - The schema name.
  • tableName (string) - The table name.
  • columnName (string) - The column name.
  • constraintName (string) - The constraint name.
  • expression (string) - The check constraint expression.
  • tx (IDbTransaction) - The transaction.
  • cancellationToken (CancellationToken) - The cancellation token.

Returns ​

Type: Task<bool>

True if the check constraint was created, otherwise false.

GetCheckConstraintAsync ​

Gets the details of a check constraint.

csharp
Task<DmCheckConstraint?> GetCheckConstraintAsync(IDbConnection db, string schemaName, string tableName, string constraintName, IDbTransaction tx, CancellationToken cancellationToken)

Parameters ​

  • db (IDbConnection) - The database connection.
  • schemaName (string) - The schema name.
  • tableName (string) - The table name.
  • constraintName (string) - The constraint name.
  • tx (IDbTransaction) - The transaction.
  • cancellationToken (CancellationToken) - The cancellation token.

Returns ​

Type: Task<DmCheckConstraint?>

The check constraint details, or null if not found.

GetCheckConstraintNameOnColumnAsync ​

Gets the name of a check constraint on a specific column.

csharp
Task<string?> GetCheckConstraintNameOnColumnAsync(IDbConnection db, string schemaName, string tableName, string columnName, IDbTransaction tx, CancellationToken cancellationToken)

Parameters ​

  • db (IDbConnection) - The database connection.
  • schemaName (string) - The schema name.
  • tableName (string) - The table name.
  • columnName (string) - The column name.
  • tx (IDbTransaction) - The transaction.
  • cancellationToken (CancellationToken) - The cancellation token.

Returns ​

Type: Task<string?>

The check constraint name, or null if not found.

GetCheckConstraintNamesAsync ​

Gets the names of all check constraints in the specified table.

csharp
Task<List<string>> GetCheckConstraintNamesAsync(IDbConnection db, string schemaName, string tableName, string constraintNameFilter, IDbTransaction tx, CancellationToken cancellationToken)

Parameters ​

  • db (IDbConnection) - The database connection.
  • schemaName (string) - The schema name.
  • tableName (string) - The table name.
  • constraintNameFilter (string) - The constraint name filter.
  • tx (IDbTransaction) - The transaction.
  • cancellationToken (CancellationToken) - The cancellation token.

Returns ​

Type: Task<List<string>>

A list of check constraint names.

GetCheckConstraintOnColumnAsync ​

Gets the details of a check constraint on a specific column.

csharp
Task<DmCheckConstraint?> GetCheckConstraintOnColumnAsync(IDbConnection db, string schemaName, string tableName, string columnName, IDbTransaction tx, CancellationToken cancellationToken)

Parameters ​

  • db (IDbConnection) - The database connection.
  • schemaName (string) - The schema name.
  • tableName (string) - The table name.
  • columnName (string) - The column name.
  • tx (IDbTransaction) - The transaction.
  • cancellationToken (CancellationToken) - The cancellation token.

Returns ​

Type: Task<DmCheckConstraint?>

The check constraint details, or null if not found.

GetCheckConstraintsAsync ​

Gets the details of all check constraints in the specified table.

csharp
Task<List<DmCheckConstraint>> GetCheckConstraintsAsync(IDbConnection db, string schemaName, string tableName, string constraintNameFilter, IDbTransaction tx, CancellationToken cancellationToken)

Parameters ​

  • db (IDbConnection) - The database connection.
  • schemaName (string) - The schema name.
  • tableName (string) - The table name.
  • constraintNameFilter (string) - The constraint name filter.
  • tx (IDbTransaction) - The transaction.
  • cancellationToken (CancellationToken) - The cancellation token.

Returns ​

Type: Task<List<DmCheckConstraint>>

A list of check constraint details.

DropCheckConstraintOnColumnIfExistsAsync ​

Drops a check constraint on a specific column if it exists.

csharp
Task<bool> DropCheckConstraintOnColumnIfExistsAsync(IDbConnection db, string schemaName, string tableName, string columnName, IDbTransaction tx, CancellationToken cancellationToken)

Parameters ​

  • db (IDbConnection) - The database connection.
  • schemaName (string) - The schema name.
  • tableName (string) - The table name.
  • columnName (string) - The column name.
  • tx (IDbTransaction) - The transaction.
  • cancellationToken (CancellationToken) - The cancellation token.

Returns ​

Type: Task<bool>

True if the check constraint was dropped, otherwise false.

DropCheckConstraintIfExistsAsync ​

Drops a check constraint if it exists.

csharp
Task<bool> DropCheckConstraintIfExistsAsync(IDbConnection db, string schemaName, string tableName, string constraintName, IDbTransaction tx, CancellationToken cancellationToken)

Parameters ​

  • db (IDbConnection) - The database connection.
  • schemaName (string) - The schema name.
  • tableName (string) - The table name.
  • constraintName (string) - The constraint name.
  • tx (IDbTransaction) - The transaction.
  • cancellationToken (CancellationToken) - The cancellation token.

Returns ​

Type: Task<bool>

True if the check constraint was dropped, otherwise false.

DoesColumnExistAsync ​

Checks if a column exists in the specified table.

csharp
Task<bool> DoesColumnExistAsync(IDbConnection db, string schemaName, string tableName, string columnName, IDbTransaction tx, CancellationToken cancellationToken)

Parameters ​

  • db (IDbConnection) - The database connection.
  • schemaName (string) - The schema name.
  • tableName (string) - The table name.
  • columnName (string) - The column name.
  • tx (IDbTransaction) - The database transaction.
  • cancellationToken (CancellationToken) - The cancellation token.

Returns ​

Type: Task<bool>

True if the column exists, otherwise false.

CreateColumnIfNotExistsAsync ​

Creates a column if it does not already exist in the specified table.

csharp
Task<bool> CreateColumnIfNotExistsAsync(IDbConnection db, DmColumn column, IDbTransaction tx, CancellationToken cancellationToken)

Parameters ​

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

Returns ​

Type: Task<bool>

True if the column was created, otherwise false.

CreateColumnIfNotExistsAsync ​

Creates a column with the specified properties if it does not already exist in the specified table.

csharp
Task<bool> CreateColumnIfNotExistsAsync(IDbConnection db, string schemaName, string tableName, string columnName, Type dotnetType, string providerDataType, Int32} length, Int32} precision, Int32} scale, string checkExpression, string defaultExpression, bool isNullable, bool isPrimaryKey, bool isAutoIncrement, bool isUnique, bool isUnicode, bool isIndexed, bool isForeignKey, string referencedTableName, string referencedColumnName, DmForeignKeyAction} onDelete, DmForeignKeyAction} onUpdate, IDbTransaction tx, CancellationToken cancellationToken)

Parameters ​

  • db (IDbConnection) - The database connection.
  • schemaName (string) - The schema name.
  • tableName (string) - The table name.
  • columnName (string) - The column name.
  • dotnetType (Type) - The .NET type of the column.
  • providerDataType (string) - The provider-specific data type.
  • length (Int32}) - The length of the column.
  • precision (Int32}) - The precision of the column.
  • scale (Int32}) - The scale of the column.
  • checkExpression (string) - The check constraint expression.
  • defaultExpression (string) - The default value expression.
  • isNullable (bool) - Indicates if the column is nullable.
  • isPrimaryKey (bool) - Indicates if the column is a primary key.
  • isAutoIncrement (bool) - Indicates if the column is auto-incremented.
  • isUnique (bool) - Indicates if the column is unique.
  • isUnicode (bool) - Indicates if the column supports unicode characters.
  • isIndexed (bool) - Indicates if the column is indexed.
  • isForeignKey (bool) - Indicates if the column is a foreign key.
  • referencedTableName (string) - The referenced table name for foreign key.
  • referencedColumnName (string) - The referenced column name for foreign key.
  • onDelete (DmForeignKeyAction}) - The action on delete for foreign key.
  • onUpdate (DmForeignKeyAction}) - The action on update for foreign key.
  • tx (IDbTransaction) - The database transaction.
  • cancellationToken (CancellationToken) - The cancellation token.

Returns ​

Type: Task<bool>

True if the column was created, otherwise false.

GetColumnAsync ​

Retrieves a column from the specified table.

csharp
Task<DmColumn?> GetColumnAsync(IDbConnection db, string schemaName, string tableName, string columnName, IDbTransaction tx, CancellationToken cancellationToken)

Parameters ​

  • db (IDbConnection) - The database connection.
  • schemaName (string) - The schema name.
  • tableName (string) - The table name.
  • columnName (string) - The column name.
  • tx (IDbTransaction) - The database transaction.
  • cancellationToken (CancellationToken) - The cancellation token.

Returns ​

Type: Task<DmColumn?>

The column definition if found, otherwise null.

GetColumnNamesAsync ​

Retrieves the names of columns from the specified table.

csharp
Task<List<string>> GetColumnNamesAsync(IDbConnection db, string schemaName, string tableName, string columnNameFilter, IDbTransaction tx, CancellationToken cancellationToken)

Parameters ​

  • db (IDbConnection) - The database connection.
  • schemaName (string) - The schema name.
  • tableName (string) - The table name.
  • columnNameFilter (string) - The column name filter.
  • tx (IDbTransaction) - The database transaction.
  • cancellationToken (CancellationToken) - The cancellation token.

Returns ​

Type: Task<List<string>>

A list of column names.

GetColumnsAsync ​

Retrieves columns from the specified table.

csharp
Task<List<DmColumn>> GetColumnsAsync(IDbConnection db, string schemaName, string tableName, string columnNameFilter, IDbTransaction tx, CancellationToken cancellationToken)

Parameters ​

  • db (IDbConnection) - The database connection.
  • schemaName (string) - The schema name.
  • tableName (string) - The table name.
  • columnNameFilter (string) - The column name filter.
  • tx (IDbTransaction) - The database transaction.
  • cancellationToken (CancellationToken) - The cancellation token.

Returns ​

Type: Task<List<DmColumn>>

A list of column definitions.

DropColumnIfExistsAsync ​

Drops a column if it exists in the specified table.

csharp
Task<bool> DropColumnIfExistsAsync(IDbConnection db, string schemaName, string tableName, string columnName, IDbTransaction tx, CancellationToken cancellationToken)

Parameters ​

  • db (IDbConnection) - The database connection.
  • schemaName (string) - The schema name.
  • tableName (string) - The table name.
  • columnName (string) - The column name.
  • tx (IDbTransaction) - The database transaction.
  • cancellationToken (CancellationToken) - The cancellation token.

Returns ​

Type: Task<bool>

True if the column was dropped, otherwise false.

RenameColumnIfExistsAsync ​

Renames a column if it exists in the specified table.

csharp
Task<bool> RenameColumnIfExistsAsync(IDbConnection db, string schemaName, string tableName, string columnName, string newColumnName, IDbTransaction tx, CancellationToken cancellationToken)

Parameters ​

  • db (IDbConnection) - The database connection.
  • schemaName (string) - The schema name.
  • tableName (string) - The table name.
  • columnName (string) - The column name.
  • newColumnName (string) - The new column name.
  • tx (IDbTransaction) - The database transaction.
  • cancellationToken (CancellationToken) - The cancellation token.

Returns ​

Type: Task<bool>

True if the column was renamed, otherwise false.

SupportsCheckConstraintsAsync ​

Determines whether the provider supports check constraints.

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

Parameters ​

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

Returns ​

Type: Task<bool>

A task that represents the asynchronous operation. The task result contains a boolean value indicating whether the provider supports check constraints.

SupportsOrderedKeysInConstraintsAsync ​

Determines whether the provider supports ordered keys in constraints.

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

Parameters ​

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

Returns ​

Type: Task<bool>

A task that represents the asynchronous operation. The task result contains a boolean value indicating whether the provider supports ordered keys in constraints.

SupportsDefaultConstraintsAsync ​

Determines whether the provider supports default constraints.

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

Parameters ​

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

Returns ​

Type: Task<bool>

A task that represents the asynchronous operation. The task result contains a boolean value indicating whether the provider supports default constraints.

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.

GetDatabaseVersionAsync ​

Gets the database version asynchronously.

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

Parameters ​

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

Returns ​

Type: Task<Version>

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

GetSchemaQualifiedIdentifierName ​

Gets the schema-qualified identifier name.

csharp
string GetSchemaQualifiedIdentifierName(string schemaName, string tableName)

Parameters ​

  • schemaName (string) - The schema name.
  • tableName (string) - The table name.

Returns ​

Type: string

The schema-qualified identifier name.

DoesDefaultConstraintExistAsync ​

Checks if a default constraint exists in the database.

csharp
Task<bool> DoesDefaultConstraintExistAsync(IDbConnection db, string schemaName, string tableName, string constraintName, IDbTransaction tx, CancellationToken cancellationToken)

Parameters ​

  • db (IDbConnection) - The database connection.
  • schemaName (string) - The schema name.
  • tableName (string) - The table name.
  • constraintName (string) - The constraint name.
  • tx (IDbTransaction) - The transaction.
  • cancellationToken (CancellationToken) - The cancellation token.

Returns ​

Type: Task<bool>

True if the constraint exists, otherwise false.

DoesDefaultConstraintExistOnColumnAsync ​

Checks if a default constraint exists on a specific column in the database.

csharp
Task<bool> DoesDefaultConstraintExistOnColumnAsync(IDbConnection db, string schemaName, string tableName, string columnName, IDbTransaction tx, CancellationToken cancellationToken)

Parameters ​

  • db (IDbConnection) - The database connection.
  • schemaName (string) - The schema name.
  • tableName (string) - The table name.
  • columnName (string) - The column name.
  • tx (IDbTransaction) - The transaction.
  • cancellationToken (CancellationToken) - The cancellation token.

Returns ​

Type: Task<bool>

True if the constraint exists, otherwise false.

CreateDefaultConstraintIfNotExistsAsync ​

Creates a default constraint if it does not exist.

csharp
Task<bool> CreateDefaultConstraintIfNotExistsAsync(IDbConnection db, DmDefaultConstraint constraint, IDbTransaction tx, CancellationToken cancellationToken)

Parameters ​

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

Returns ​

Type: Task<bool>

True if the constraint was created, otherwise false.

CreateDefaultConstraintIfNotExistsAsync ​

Creates a default constraint if it does not exist.

csharp
Task<bool> CreateDefaultConstraintIfNotExistsAsync(IDbConnection db, string schemaName, string tableName, string columnName, string constraintName, string expression, IDbTransaction tx, CancellationToken cancellationToken)

Parameters ​

  • db (IDbConnection) - The database connection.
  • schemaName (string) - The schema name.
  • tableName (string) - The table name.
  • columnName (string) - The column name.
  • constraintName (string) - The constraint name.
  • expression (string) - The expression.
  • tx (IDbTransaction) - The transaction.
  • cancellationToken (CancellationToken) - The cancellation token.

Returns ​

Type: Task<bool>

True if the constraint was created, otherwise false.

GetDefaultConstraintAsync ​

Gets a default constraint from the database.

csharp
Task<DmDefaultConstraint?> GetDefaultConstraintAsync(IDbConnection db, string schemaName, string tableName, string constraintName, IDbTransaction tx, CancellationToken cancellationToken)

Parameters ​

  • db (IDbConnection) - The database connection.
  • schemaName (string) - The schema name.
  • tableName (string) - The table name.
  • constraintName (string) - The constraint name.
  • tx (IDbTransaction) - The transaction.
  • cancellationToken (CancellationToken) - The cancellation token.

Returns ​

Type: Task<DmDefaultConstraint?>

The default constraint if found, otherwise null.

GetDefaultConstraintNameOnColumnAsync ​

Gets the name of the default constraint on a specific column.

csharp
Task<string?> GetDefaultConstraintNameOnColumnAsync(IDbConnection db, string schemaName, string tableName, string columnName, IDbTransaction tx, CancellationToken cancellationToken)

Parameters ​

  • db (IDbConnection) - The database connection.
  • schemaName (string) - The schema name.
  • tableName (string) - The table name.
  • columnName (string) - The column name.
  • tx (IDbTransaction) - The transaction.
  • cancellationToken (CancellationToken) - The cancellation token.

Returns ​

Type: Task<string?>

The name of the default constraint if found, otherwise null.

GetDefaultConstraintNamesAsync ​

Gets the names of all default constraints in the database.

csharp
Task<List<string>> GetDefaultConstraintNamesAsync(IDbConnection db, string schemaName, string tableName, string constraintNameFilter, IDbTransaction tx, CancellationToken cancellationToken)

Parameters ​

  • db (IDbConnection) - The database connection.
  • schemaName (string) - The schema name.
  • tableName (string) - The table name.
  • constraintNameFilter (string) - The constraint name filter.
  • tx (IDbTransaction) - The transaction.
  • cancellationToken (CancellationToken) - The cancellation token.

Returns ​

Type: Task<List<string>>

A list of default constraint names.

GetDefaultConstraintOnColumnAsync ​

Gets the default constraint on a specific column.

csharp
Task<DmDefaultConstraint?> GetDefaultConstraintOnColumnAsync(IDbConnection db, string schemaName, string tableName, string columnName, IDbTransaction tx, CancellationToken cancellationToken)

Parameters ​

  • db (IDbConnection) - The database connection.
  • schemaName (string) - The schema name.
  • tableName (string) - The table name.
  • columnName (string) - The column name.
  • tx (IDbTransaction) - The transaction.
  • cancellationToken (CancellationToken) - The cancellation token.

Returns ​

Type: Task<DmDefaultConstraint?>

The default constraint if found, otherwise null.

GetDefaultConstraintsAsync ​

Gets all default constraints in the database.

csharp
Task<List<DmDefaultConstraint>> GetDefaultConstraintsAsync(IDbConnection db, string schemaName, string tableName, string constraintNameFilter, IDbTransaction tx, CancellationToken cancellationToken)

Parameters ​

  • db (IDbConnection) - The database connection.
  • schemaName (string) - The schema name.
  • tableName (string) - The table name.
  • constraintNameFilter (string) - The constraint name filter.
  • tx (IDbTransaction) - The transaction.
  • cancellationToken (CancellationToken) - The cancellation token.

Returns ​

Type: Task<List<DmDefaultConstraint>>

A list of default constraints.

DropDefaultConstraintOnColumnIfExistsAsync ​

Drops the default constraint on a specific column if it exists.

csharp
Task<bool> DropDefaultConstraintOnColumnIfExistsAsync(IDbConnection db, string schemaName, string tableName, string columnName, IDbTransaction tx, CancellationToken cancellationToken)

Parameters ​

  • db (IDbConnection) - The database connection.
  • schemaName (string) - The schema name.
  • tableName (string) - The table name.
  • columnName (string) - The column name.
  • tx (IDbTransaction) - The transaction.
  • cancellationToken (CancellationToken) - The cancellation token.

Returns ​

Type: Task<bool>

True if the constraint was dropped, otherwise false.

DropDefaultConstraintIfExistsAsync ​

Drops a default constraint if it exists.

csharp
Task<bool> DropDefaultConstraintIfExistsAsync(IDbConnection db, string schemaName, string tableName, string constraintName, IDbTransaction tx, CancellationToken cancellationToken)

Parameters ​

  • db (IDbConnection) - The database connection.
  • schemaName (string) - The schema name.
  • tableName (string) - The table name.
  • constraintName (string) - The constraint name.
  • tx (IDbTransaction) - The transaction.
  • cancellationToken (CancellationToken) - The cancellation token.

Returns ​

Type: Task<bool>

True if the constraint was dropped, otherwise false.

DoesForeignKeyConstraintExistAsync ​

Checks if a foreign key constraint exists.

csharp
Task<bool> DoesForeignKeyConstraintExistAsync(IDbConnection db, string schemaName, string tableName, string constraintName, IDbTransaction tx, CancellationToken cancellationToken)

Parameters ​

  • db (IDbConnection) - The database connection.
  • schemaName (string) - The schema name.
  • tableName (string) - The table name.
  • constraintName (string) - The constraint name.
  • tx (IDbTransaction) - The transaction.
  • cancellationToken (CancellationToken) - The cancellation token.

Returns ​

Type: Task<bool>

True if the constraint exists, otherwise false.

DoesForeignKeyConstraintExistOnColumnAsync ​

Checks if a foreign key constraint exists on a specific column.

csharp
Task<bool> DoesForeignKeyConstraintExistOnColumnAsync(IDbConnection db, string schemaName, string tableName, string columnName, IDbTransaction tx, CancellationToken cancellationToken)

Parameters ​

  • db (IDbConnection) - The database connection.
  • schemaName (string) - The schema name.
  • tableName (string) - The table name.
  • columnName (string) - The column name.
  • tx (IDbTransaction) - The transaction.
  • cancellationToken (CancellationToken) - The cancellation token.

Returns ​

Type: Task<bool>

True if the constraint exists on the column, otherwise false.

CreateForeignKeyConstraintIfNotExistsAsync ​

Creates a foreign key constraint if it does not exist.

csharp
Task<bool> CreateForeignKeyConstraintIfNotExistsAsync(IDbConnection db, DmForeignKeyConstraint constraint, IDbTransaction tx, CancellationToken cancellationToken)

Parameters ​

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

Returns ​

Type: Task<bool>

True if the constraint was created, otherwise false.

CreateForeignKeyConstraintIfNotExistsAsync ​

Creates a foreign key constraint if it does not exist.

csharp
Task<bool> CreateForeignKeyConstraintIfNotExistsAsync(IDbConnection db, string schemaName, string tableName, string constraintName, DmOrderedColumn[] sourceColumns, string referencedTableName, DmOrderedColumn[] referencedColumns, DmForeignKeyAction onDelete, DmForeignKeyAction onUpdate, IDbTransaction tx, CancellationToken cancellationToken)

Parameters ​

  • db (IDbConnection) - The database connection.
  • schemaName (string) - The schema name.
  • tableName (string) - The table name.
  • constraintName (string) - The constraint name.
  • sourceColumns (DmOrderedColumn[]) - The source columns.
  • referencedTableName (string) - The referenced table name.
  • referencedColumns (DmOrderedColumn[]) - The referenced columns.
  • onDelete (DmForeignKeyAction) - The delete action.
  • onUpdate (DmForeignKeyAction) - The update action.
  • tx (IDbTransaction) - The transaction.
  • cancellationToken (CancellationToken) - The cancellation token.

Returns ​

Type: Task<bool>

True if the constraint was created, otherwise false.

GetForeignKeyConstraintAsync ​

Gets a foreign key constraint.

csharp
Task<DmForeignKeyConstraint?> GetForeignKeyConstraintAsync(IDbConnection db, string schemaName, string tableName, string constraintName, IDbTransaction tx, CancellationToken cancellationToken)

Parameters ​

  • db (IDbConnection) - The database connection.
  • schemaName (string) - The schema name.
  • tableName (string) - The table name.
  • constraintName (string) - The constraint name.
  • tx (IDbTransaction) - The transaction.
  • cancellationToken (CancellationToken) - The cancellation token.

Returns ​

Type: Task<DmForeignKeyConstraint?>

The foreign key constraint if found, otherwise null.

GetForeignKeyConstraintNameOnColumnAsync ​

Gets the name of the foreign key constraint on a specific column.

csharp
Task<string?> GetForeignKeyConstraintNameOnColumnAsync(IDbConnection db, string schemaName, string tableName, string columnName, IDbTransaction tx, CancellationToken cancellationToken)

Parameters ​

  • db (IDbConnection) - The database connection.
  • schemaName (string) - The schema name.
  • tableName (string) - The table name.
  • columnName (string) - The column name.
  • tx (IDbTransaction) - The transaction.
  • cancellationToken (CancellationToken) - The cancellation token.

Returns ​

Type: Task<string?>

The name of the foreign key constraint if found, otherwise null.

GetForeignKeyConstraintNamesAsync ​

Gets the names of the foreign key constraints.

csharp
Task<List<string>> GetForeignKeyConstraintNamesAsync(IDbConnection db, string schemaName, string tableName, string constraintNameFilter, IDbTransaction tx, CancellationToken cancellationToken)

Parameters ​

  • db (IDbConnection) - The database connection.
  • schemaName (string) - The schema name.
  • tableName (string) - The table name.
  • constraintNameFilter (string) - The constraint name filter.
  • tx (IDbTransaction) - The transaction.
  • cancellationToken (CancellationToken) - The cancellation token.

Returns ​

Type: Task<List<string>>

A list of foreign key constraint names.

GetForeignKeyConstraintOnColumnAsync ​

Gets the foreign key constraint on a specific column.

csharp
Task<DmForeignKeyConstraint?> GetForeignKeyConstraintOnColumnAsync(IDbConnection db, string schemaName, string tableName, string columnName, IDbTransaction tx, CancellationToken cancellationToken)

Parameters ​

  • db (IDbConnection) - The database connection.
  • schemaName (string) - The schema name.
  • tableName (string) - The table name.
  • columnName (string) - The column name.
  • tx (IDbTransaction) - The transaction.
  • cancellationToken (CancellationToken) - The cancellation token.

Returns ​

Type: Task<DmForeignKeyConstraint?>

The foreign key constraint if found, otherwise null.

GetForeignKeyConstraintsAsync ​

Gets the foreign key constraints.

csharp
Task<List<DmForeignKeyConstraint>> GetForeignKeyConstraintsAsync(IDbConnection db, string schemaName, string tableName, string constraintNameFilter, IDbTransaction tx, CancellationToken cancellationToken)

Parameters ​

  • db (IDbConnection) - The database connection.
  • schemaName (string) - The schema name.
  • tableName (string) - The table name.
  • constraintNameFilter (string) - The constraint name filter.
  • tx (IDbTransaction) - The transaction.
  • cancellationToken (CancellationToken) - The cancellation token.

Returns ​

Type: Task<List<DmForeignKeyConstraint>>

A list of foreign key constraints.

DropForeignKeyConstraintOnColumnIfExistsAsync ​

Drops the foreign key constraint on a specific column if it exists.

csharp
Task<bool> DropForeignKeyConstraintOnColumnIfExistsAsync(IDbConnection db, string schemaName, string tableName, string columnName, IDbTransaction tx, CancellationToken cancellationToken)

Parameters ​

  • db (IDbConnection) - The database connection.
  • schemaName (string) - The schema name.
  • tableName (string) - The table name.
  • columnName (string) - The column name.
  • tx (IDbTransaction) - The transaction.
  • cancellationToken (CancellationToken) - The cancellation token.

Returns ​

Type: Task<bool>

True if the constraint was dropped, otherwise false.

DropForeignKeyConstraintIfExistsAsync ​

Drops the foreign key constraint if it exists.

csharp
Task<bool> DropForeignKeyConstraintIfExistsAsync(IDbConnection db, string schemaName, string tableName, string constraintName, IDbTransaction tx, CancellationToken cancellationToken)

Parameters ​

  • db (IDbConnection) - The database connection.
  • schemaName (string) - The schema name.
  • tableName (string) - The table name.
  • constraintName (string) - The constraint name.
  • tx (IDbTransaction) - The transaction.
  • cancellationToken (CancellationToken) - The cancellation token.

Returns ​

Type: Task<bool>

True if the constraint was dropped, otherwise false.

DoesIndexExistAsync ​

Checks if an index exists in the database.

csharp
Task<bool> DoesIndexExistAsync(IDbConnection db, string schemaName, string tableName, string indexName, IDbTransaction tx, CancellationToken cancellationToken)

Parameters ​

  • db (IDbConnection) - The database connection.
  • schemaName (string) - The schema name.
  • tableName (string) - The table name.
  • indexName (string) - The index name.
  • tx (IDbTransaction) - The transaction.
  • cancellationToken (CancellationToken) - The cancellation token.

Returns ​

Type: Task<bool>

True if the index exists, otherwise false.

DoesIndexExistOnColumnAsync ​

Checks if an index exists on a specific column in the database.

csharp
Task<bool> DoesIndexExistOnColumnAsync(IDbConnection db, string schemaName, string tableName, string columnName, IDbTransaction tx, CancellationToken cancellationToken)

Parameters ​

  • db (IDbConnection) - The database connection.
  • schemaName (string) - The schema name.
  • tableName (string) - The table name.
  • columnName (string) - The column name.
  • tx (IDbTransaction) - The transaction.
  • cancellationToken (CancellationToken) - The cancellation token.

Returns ​

Type: Task<bool>

True if the index exists on the column, otherwise false.

CreateIndexIfNotExistsAsync ​

Creates an index if it does not already exist.

csharp
Task<bool> CreateIndexIfNotExistsAsync(IDbConnection db, DmIndex index, IDbTransaction tx, CancellationToken cancellationToken)

Parameters ​

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

Returns ​

Type: Task<bool>

True if the index was created, otherwise false.

CreateIndexIfNotExistsAsync ​

Creates an index if it does not already exist.

csharp
Task<bool> CreateIndexIfNotExistsAsync(IDbConnection db, string schemaName, string tableName, string indexName, DmOrderedColumn[] columns, bool isUnique, IDbTransaction tx, CancellationToken cancellationToken)

Parameters ​

  • db (IDbConnection) - The database connection.
  • schemaName (string) - The schema name.
  • tableName (string) - The table name.
  • indexName (string) - The index name.
  • columns (DmOrderedColumn[]) - The columns to include in the index.
  • isUnique (bool) - Whether the index is unique.
  • tx (IDbTransaction) - The transaction.
  • cancellationToken (CancellationToken) - The cancellation token.

Returns ​

Type: Task<bool>

True if the index was created, otherwise false.

GetIndexAsync ​

Retrieves an index from the database.

csharp
Task<DmIndex?> GetIndexAsync(IDbConnection db, string schemaName, string tableName, string indexName, IDbTransaction tx, CancellationToken cancellationToken)

Parameters ​

  • db (IDbConnection) - The database connection.
  • schemaName (string) - The schema name.
  • tableName (string) - The table name.
  • indexName (string) - The index name.
  • tx (IDbTransaction) - The transaction.
  • cancellationToken (CancellationToken) - The cancellation token.

Returns ​

Type: Task<DmIndex?>

The index details, or null if the index does not exist.

GetIndexesAsync ​

Retrieves a list of indexes from the database.

csharp
Task<List<DmIndex>> GetIndexesAsync(IDbConnection db, string schemaName, string tableName, string indexNameFilter, IDbTransaction tx, CancellationToken cancellationToken)

Parameters ​

  • db (IDbConnection) - The database connection.
  • schemaName (string) - The schema name.
  • tableName (string) - The table name.
  • indexNameFilter (string) - An optional filter for the index name.
  • tx (IDbTransaction) - The transaction.
  • cancellationToken (CancellationToken) - The cancellation token.

Returns ​

Type: Task<List<DmIndex>>

A list of indexes.

GetIndexNamesOnColumnAsync ​

Retrieves a list of index names on a specific column from the database.

csharp
Task<List<string>> GetIndexNamesOnColumnAsync(IDbConnection db, string schemaName, string tableName, string columnName, IDbTransaction tx, CancellationToken cancellationToken)

Parameters ​

  • db (IDbConnection) - The database connection.
  • schemaName (string) - The schema name.
  • tableName (string) - The table name.
  • columnName (string) - The column name.
  • tx (IDbTransaction) - The transaction.
  • cancellationToken (CancellationToken) - The cancellation token.

Returns ​

Type: Task<List<string>>

A list of index names.

GetIndexNamesAsync ​

Retrieves a list of index names from the database.

csharp
Task<List<string>> GetIndexNamesAsync(IDbConnection db, string schemaName, string tableName, string indexNameFilter, IDbTransaction tx, CancellationToken cancellationToken)

Parameters ​

  • db (IDbConnection) - The database connection.
  • schemaName (string) - The schema name.
  • tableName (string) - The table name.
  • indexNameFilter (string) - An optional filter for the index name.
  • tx (IDbTransaction) - The transaction.
  • cancellationToken (CancellationToken) - The cancellation token.

Returns ​

Type: Task<List<string>>

A list of index names.

GetIndexesOnColumnAsync ​

Retrieves a list of indexes on a specific column from the database.

csharp
Task<List<DmIndex>> GetIndexesOnColumnAsync(IDbConnection db, string schemaName, string tableName, string columnName, IDbTransaction tx, CancellationToken cancellationToken)

Parameters ​

  • db (IDbConnection) - The database connection.
  • schemaName (string) - The schema name.
  • tableName (string) - The table name.
  • columnName (string) - The column name.
  • tx (IDbTransaction) - The transaction.
  • cancellationToken (CancellationToken) - The cancellation token.

Returns ​

Type: Task<List<DmIndex>>

A list of indexes.

DropIndexIfExistsAsync ​

Drops an index if it exists in the database.

csharp
Task<bool> DropIndexIfExistsAsync(IDbConnection db, string schemaName, string tableName, string indexName, IDbTransaction tx, CancellationToken cancellationToken)

Parameters ​

  • db (IDbConnection) - The database connection.
  • schemaName (string) - The schema name.
  • tableName (string) - The table name.
  • indexName (string) - The index name.
  • tx (IDbTransaction) - The transaction.
  • cancellationToken (CancellationToken) - The cancellation token.

Returns ​

Type: Task<bool>

True if the index was dropped, otherwise false.

DropIndexesOnColumnIfExistsAsync ​

Drops indexes on a specific column if they exist in the database.

csharp
Task<bool> DropIndexesOnColumnIfExistsAsync(IDbConnection db, string schemaName, string tableName, string columnName, IDbTransaction tx, CancellationToken cancellationToken)

Parameters ​

  • db (IDbConnection) - The database connection.
  • schemaName (string) - The schema name.
  • tableName (string) - The table name.
  • columnName (string) - The column name.
  • tx (IDbTransaction) - The transaction.
  • cancellationToken (CancellationToken) - The cancellation token.

Returns ​

Type: Task<bool>

True if any indexes were dropped, otherwise false.

DoesPrimaryKeyConstraintExistAsync ​

Checks if a primary key constraint exists on the specified table.

csharp
Task<bool> DoesPrimaryKeyConstraintExistAsync(IDbConnection db, string schemaName, string tableName, IDbTransaction tx, CancellationToken cancellationToken)

Parameters ​

  • db (IDbConnection) - The database connection.
  • schemaName (string) - The schema name.
  • tableName (string) - The table name.
  • tx (IDbTransaction) - The transaction to use, or null.
  • cancellationToken (CancellationToken) - The cancellation token.

Returns ​

Type: Task<bool>

True if the primary key constraint exists, otherwise false.

CreatePrimaryKeyConstraintIfNotExistsAsync ​

Creates a primary key constraint if it does not already exist.

csharp
Task<bool> CreatePrimaryKeyConstraintIfNotExistsAsync(IDbConnection db, DmPrimaryKeyConstraint constraint, IDbTransaction tx, CancellationToken cancellationToken)

Parameters ​

  • db (IDbConnection) - The database connection.
  • constraint (DmPrimaryKeyConstraint) - The primary key constraint details.
  • tx (IDbTransaction) - The transaction to use, or null.
  • cancellationToken (CancellationToken) - The cancellation token.

Returns ​

Type: Task<bool>

True if the primary key constraint was created, otherwise false.

CreatePrimaryKeyConstraintIfNotExistsAsync ​

Creates a primary key constraint if it does not already exist.

csharp
Task<bool> CreatePrimaryKeyConstraintIfNotExistsAsync(IDbConnection db, string schemaName, string tableName, string constraintName, DmOrderedColumn[] columns, IDbTransaction tx, CancellationToken cancellationToken)

Parameters ​

  • db (IDbConnection) - The database connection.
  • schemaName (string) - The schema name.
  • tableName (string) - The table name.
  • constraintName (string) - The constraint name.
  • columns (DmOrderedColumn[]) - The columns that make up the primary key.
  • tx (IDbTransaction) - The transaction to use, or null.
  • cancellationToken (CancellationToken) - The cancellation token.

Returns ​

Type: Task<bool>

True if the primary key constraint was created, otherwise false.

GetPrimaryKeyConstraintAsync ​

Gets the primary key constraint for the specified table.

csharp
Task<DmPrimaryKeyConstraint?> GetPrimaryKeyConstraintAsync(IDbConnection db, string schemaName, string tableName, IDbTransaction tx, CancellationToken cancellationToken)

Parameters ​

  • db (IDbConnection) - The database connection.
  • schemaName (string) - The schema name.
  • tableName (string) - The table name.
  • tx (IDbTransaction) - The transaction to use, or null.
  • cancellationToken (CancellationToken) - The cancellation token.

Returns ​

Type: Task<DmPrimaryKeyConstraint?>

The primary key constraint, or null if it does not exist.

DropPrimaryKeyConstraintIfExistsAsync ​

Drops the primary key constraint if it exists.

csharp
Task<bool> DropPrimaryKeyConstraintIfExistsAsync(IDbConnection db, string schemaName, string tableName, IDbTransaction tx, CancellationToken cancellationToken)

Parameters ​

  • db (IDbConnection) - The database connection.
  • schemaName (string) - The schema name.
  • tableName (string) - The table name.
  • tx (IDbTransaction) - The transaction to use, or null.
  • cancellationToken (CancellationToken) - The cancellation token.

Returns ​

Type: Task<bool>

True if the primary key constraint was dropped, otherwise false.

DoesSchemaExistAsync ​

Checks if a schema exists in the database.

csharp
Task<bool> DoesSchemaExistAsync(IDbConnection db, string schemaName, IDbTransaction tx, CancellationToken cancellationToken)

Parameters ​

  • db (IDbConnection) - The database connection.
  • schemaName (string) - The name of the schema.
  • tx (IDbTransaction) - The database transaction.
  • cancellationToken (CancellationToken) - The cancellation token.

Returns ​

Type: Task<bool>

True if the schema exists, otherwise false.

CreateSchemaIfNotExistsAsync ​

Creates a schema if it does not exist in the database.

csharp
Task<bool> CreateSchemaIfNotExistsAsync(IDbConnection db, string schemaName, IDbTransaction tx, CancellationToken cancellationToken)

Parameters ​

  • db (IDbConnection) - The database connection.
  • schemaName (string) - The name of the schema.
  • tx (IDbTransaction) - The database transaction.
  • cancellationToken (CancellationToken) - The cancellation token.

Returns ​

Type: Task<bool>

True if the schema was created, otherwise false.

GetSchemaNamesAsync ​

Retrieves the list of schema names from the database.

csharp
Task<List<string>> GetSchemaNamesAsync(IDbConnection db, string schemaNameFilter, IDbTransaction tx, CancellationToken cancellationToken)

Parameters ​

  • db (IDbConnection) - The database connection.
  • schemaNameFilter (string) - The schema name filter.
  • tx (IDbTransaction) - The database transaction.
  • cancellationToken (CancellationToken) - The cancellation token.

Returns ​

Type: Task<List<string>>

A list of schema names.

DropSchemaIfExistsAsync ​

Drops a schema if it exists in the database.

csharp
Task<bool> DropSchemaIfExistsAsync(IDbConnection db, string schemaName, IDbTransaction tx, CancellationToken cancellationToken)

Parameters ​

  • db (IDbConnection) - The database connection.
  • schemaName (string) - The name of the schema.
  • tx (IDbTransaction) - The database transaction.
  • cancellationToken (CancellationToken) - The cancellation token.

Returns ​

Type: Task<bool>

True if the schema was dropped, otherwise false.

DoesTableExistAsync ​

Checks if a table exists in the database.

csharp
Task<bool> DoesTableExistAsync(IDbConnection db, string schemaName, string tableName, IDbTransaction tx, CancellationToken cancellationToken)

Parameters ​

  • db (IDbConnection) - The database connection.
  • schemaName (string) - The schema name.
  • tableName (string) - The table name.
  • tx (IDbTransaction) - The transaction.
  • cancellationToken (CancellationToken) - The cancellation token.

Returns ​

Type: Task<bool>

True if the table exists, otherwise false.

CreateTablesIfNotExistsAsync ​

Creates tables if they do not exist.

csharp
Task CreateTablesIfNotExistsAsync(IDbConnection db, DmTable[] tables, IDbTransaction tx, CancellationToken cancellationToken)

Parameters ​

  • db (IDbConnection) - The database connection.
  • tables (DmTable[]) - The tables to create.
  • tx (IDbTransaction) - The transaction.
  • cancellationToken (CancellationToken) - The cancellation token.

Returns ​

Type: Task

A task that represents the asynchronous operation.

CreateTableIfNotExistsAsync ​

Creates a table if it does not exist.

csharp
Task<bool> CreateTableIfNotExistsAsync(IDbConnection db, DmTable table, IDbTransaction tx, CancellationToken cancellationToken)

Parameters ​

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

Returns ​

Type: Task<bool>

True if the table was created, otherwise false.

CreateTableIfNotExistsAsync ​

Creates a table if it does not exist.

csharp
Task<bool> CreateTableIfNotExistsAsync(IDbConnection db, string schemaName, string tableName, DmColumn[] columns, DmPrimaryKeyConstraint primaryKey, DmCheckConstraint[] checkConstraints, DmDefaultConstraint[] defaultConstraints, DmUniqueConstraint[] uniqueConstraints, DmForeignKeyConstraint[] foreignKeyConstraints, DmIndex[] indexes, IDbTransaction tx, CancellationToken cancellationToken)

Parameters ​

  • db (IDbConnection) - The database connection.
  • schemaName (string) - The schema name.
  • tableName (string) - The table name.
  • columns (DmColumn[]) - The columns of the table.
  • primaryKey (DmPrimaryKeyConstraint) - The primary key constraint.
  • checkConstraints (DmCheckConstraint[]) - The check constraints.
  • defaultConstraints (DmDefaultConstraint[]) - The default constraints.
  • uniqueConstraints (DmUniqueConstraint[]) - The unique constraints.
  • foreignKeyConstraints (DmForeignKeyConstraint[]) - The foreign key constraints.
  • indexes (DmIndex[]) - The indexes.
  • tx (IDbTransaction) - The transaction.
  • cancellationToken (CancellationToken) - The cancellation token.

Returns ​

Type: Task<bool>

True if the table was created, otherwise false.

GetTableAsync ​

Gets a table from the database.

csharp
Task<DmTable?> GetTableAsync(IDbConnection db, string schemaName, string tableName, IDbTransaction tx, CancellationToken cancellationToken)

Parameters ​

  • db (IDbConnection) - The database connection.
  • schemaName (string) - The schema name.
  • tableName (string) - The table name.
  • tx (IDbTransaction) - The transaction.
  • cancellationToken (CancellationToken) - The cancellation token.

Returns ​

Type: Task<DmTable?>

The table if found, otherwise null.

GetTableNamesAsync ​

Gets the names of tables in the database.

csharp
Task<List<string>> GetTableNamesAsync(IDbConnection db, string schemaName, string tableNameFilter, IDbTransaction tx, CancellationToken cancellationToken)

Parameters ​

  • db (IDbConnection) - The database connection.
  • schemaName (string) - The schema name.
  • tableNameFilter (string) - The table name filter.
  • tx (IDbTransaction) - The transaction.
  • cancellationToken (CancellationToken) - The cancellation token.

Returns ​

Type: Task<List<string>>

A list of table names.

GetTablesAsync ​

Gets tables from the database.

csharp
Task<List<DmTable>> GetTablesAsync(IDbConnection db, string schemaName, string tableNameFilter, IDbTransaction tx, CancellationToken cancellationToken)

Parameters ​

  • db (IDbConnection) - The database connection.
  • schemaName (string) - The schema name.
  • tableNameFilter (string) - The table name filter.
  • tx (IDbTransaction) - The transaction.
  • cancellationToken (CancellationToken) - The cancellation token.

Returns ​

Type: Task<List<DmTable>>

A list of tables.

DropTableIfExistsAsync ​

Drops a table if it exists.

csharp
Task<bool> DropTableIfExistsAsync(IDbConnection db, string schemaName, string tableName, IDbTransaction tx, CancellationToken cancellationToken)

Parameters ​

  • db (IDbConnection) - The database connection.
  • schemaName (string) - The schema name.
  • tableName (string) - The table name.
  • tx (IDbTransaction) - The transaction.
  • cancellationToken (CancellationToken) - The cancellation token.

Returns ​

Type: Task<bool>

True if the table was dropped, otherwise false.

RenameTableIfExistsAsync ​

Renames a table if it exists.

csharp
Task<bool> RenameTableIfExistsAsync(IDbConnection db, string schemaName, string tableName, string newTableName, IDbTransaction tx, CancellationToken cancellationToken)

Parameters ​

  • db (IDbConnection) - The database connection.
  • schemaName (string) - The schema name.
  • tableName (string) - The table name.
  • newTableName (string) - The new table name.
  • tx (IDbTransaction) - The transaction.
  • cancellationToken (CancellationToken) - The cancellation token.

Returns ​

Type: Task<bool>

True if the table was renamed, otherwise false.

TruncateTableIfExistsAsync ​

Truncates a table if it exists.

csharp
Task<bool> TruncateTableIfExistsAsync(IDbConnection db, string schemaName, string tableName, IDbTransaction tx, CancellationToken cancellationToken)

Parameters ​

  • db (IDbConnection) - The database connection.
  • schemaName (string) - The schema name.
  • tableName (string) - The table name.
  • tx (IDbTransaction) - The transaction.
  • cancellationToken (CancellationToken) - The cancellation token.

Returns ​

Type: Task<bool>

True if the table was truncated, otherwise false.

DoesUniqueConstraintExistAsync ​

Checks if a unique constraint exists in the specified table.

csharp
Task<bool> DoesUniqueConstraintExistAsync(IDbConnection db, string schemaName, string tableName, string constraintName, IDbTransaction tx, CancellationToken cancellationToken)

Parameters ​

  • db (IDbConnection) - The database connection.
  • schemaName (string) - The schema name.
  • tableName (string) - The table name.
  • constraintName (string) - The constraint name.
  • tx (IDbTransaction) - The transaction to use.
  • cancellationToken (CancellationToken) - The cancellation token.

Returns ​

Type: Task<bool>

True if the unique constraint exists, otherwise false.

DoesUniqueConstraintExistOnColumnAsync ​

Checks if a unique constraint exists on the specified column.

csharp
Task<bool> DoesUniqueConstraintExistOnColumnAsync(IDbConnection db, string schemaName, string tableName, string columnName, IDbTransaction tx, CancellationToken cancellationToken)

Parameters ​

  • db (IDbConnection) - The database connection.
  • schemaName (string) - The schema name.
  • tableName (string) - The table name.
  • columnName (string) - The column name.
  • tx (IDbTransaction) - The transaction to use.
  • cancellationToken (CancellationToken) - The cancellation token.

Returns ​

Type: Task<bool>

True if the unique constraint exists on the column, otherwise false.

CreateUniqueConstraintIfNotExistsAsync ​

Creates a unique constraint if it does not already exist.

csharp
Task<bool> CreateUniqueConstraintIfNotExistsAsync(IDbConnection db, DmUniqueConstraint constraint, IDbTransaction tx, CancellationToken cancellationToken)

Parameters ​

  • db (IDbConnection) - The database connection.
  • constraint (DmUniqueConstraint) - The unique constraint to create.
  • tx (IDbTransaction) - The transaction to use.
  • cancellationToken (CancellationToken) - The cancellation token.

Returns ​

Type: Task<bool>

True if the unique constraint was created, otherwise false.

CreateUniqueConstraintIfNotExistsAsync ​

Creates a unique constraint if it does not already exist.

csharp
Task<bool> CreateUniqueConstraintIfNotExistsAsync(IDbConnection db, string schemaName, string tableName, string constraintName, DmOrderedColumn[] columns, IDbTransaction tx, CancellationToken cancellationToken)

Parameters ​

  • db (IDbConnection) - The database connection.
  • schemaName (string) - The schema name.
  • tableName (string) - The table name.
  • constraintName (string) - The constraint name.
  • columns (DmOrderedColumn[]) - The columns to include in the constraint.
  • tx (IDbTransaction) - The transaction to use.
  • cancellationToken (CancellationToken) - The cancellation token.

Returns ​

Type: Task<bool>

True if the unique constraint was created, otherwise false.

GetUniqueConstraintAsync ​

Gets a unique constraint by name.

csharp
Task<DmUniqueConstraint?> GetUniqueConstraintAsync(IDbConnection db, string schemaName, string tableName, string constraintName, IDbTransaction tx, CancellationToken cancellationToken)

Parameters ​

  • db (IDbConnection) - The database connection.
  • schemaName (string) - The schema name.
  • tableName (string) - The table name.
  • constraintName (string) - The constraint name.
  • tx (IDbTransaction) - The transaction to use.
  • cancellationToken (CancellationToken) - The cancellation token.

Returns ​

Type: Task<DmUniqueConstraint?>

The unique constraint if found, otherwise null.

GetUniqueConstraintNameOnColumnAsync ​

Gets the name of the unique constraint on the specified column.

csharp
Task<string?> GetUniqueConstraintNameOnColumnAsync(IDbConnection db, string schemaName, string tableName, string columnName, IDbTransaction tx, CancellationToken cancellationToken)

Parameters ​

  • db (IDbConnection) - The database connection.
  • schemaName (string) - The schema name.
  • tableName (string) - The table name.
  • columnName (string) - The column name.
  • tx (IDbTransaction) - The transaction to use.
  • cancellationToken (CancellationToken) - The cancellation token.

Returns ​

Type: Task<string?>

The name of the unique constraint if found, otherwise null.

GetUniqueConstraintNamesAsync ​

Gets the names of all unique constraints in the specified table.

csharp
Task<List<string>> GetUniqueConstraintNamesAsync(IDbConnection db, string schemaName, string tableName, string constraintNameFilter, IDbTransaction tx, CancellationToken cancellationToken)

Parameters ​

  • db (IDbConnection) - The database connection.
  • schemaName (string) - The schema name.
  • tableName (string) - The table name.
  • constraintNameFilter (string) - An optional filter for constraint names.
  • tx (IDbTransaction) - The transaction to use.
  • cancellationToken (CancellationToken) - The cancellation token.

Returns ​

Type: Task<List<string>>

A list of unique constraint names.

GetUniqueConstraintOnColumnAsync ​

Gets the unique constraint on the specified column.

csharp
Task<DmUniqueConstraint?> GetUniqueConstraintOnColumnAsync(IDbConnection db, string schemaName, string tableName, string columnName, IDbTransaction tx, CancellationToken cancellationToken)

Parameters ​

  • db (IDbConnection) - The database connection.
  • schemaName (string) - The schema name.
  • tableName (string) - The table name.
  • columnName (string) - The column name.
  • tx (IDbTransaction) - The transaction to use.
  • cancellationToken (CancellationToken) - The cancellation token.

Returns ​

Type: Task<DmUniqueConstraint?>

The unique constraint if found, otherwise null.

GetUniqueConstraintsAsync ​

Gets all unique constraints in the specified table.

csharp
Task<List<DmUniqueConstraint>> GetUniqueConstraintsAsync(IDbConnection db, string schemaName, string tableName, string constraintNameFilter, IDbTransaction tx, CancellationToken cancellationToken)

Parameters ​

  • db (IDbConnection) - The database connection.
  • schemaName (string) - The schema name.
  • tableName (string) - The table name.
  • constraintNameFilter (string) - An optional filter for constraint names.
  • tx (IDbTransaction) - The transaction to use.
  • cancellationToken (CancellationToken) - The cancellation token.

Returns ​

Type: Task<List<DmUniqueConstraint>>

A list of unique constraints.

DropUniqueConstraintIfExistsAsync ​

Drops a unique constraint if it exists.

csharp
Task<bool> DropUniqueConstraintIfExistsAsync(IDbConnection db, string schemaName, string tableName, string constraintName, IDbTransaction tx, CancellationToken cancellationToken)

Parameters ​

  • db (IDbConnection) - The database connection.
  • schemaName (string) - The schema name.
  • tableName (string) - The table name.
  • constraintName (string) - The constraint name.
  • tx (IDbTransaction) - The transaction to use.
  • cancellationToken (CancellationToken) - The cancellation token.

Returns ​

Type: Task<bool>

True if the unique constraint was dropped, otherwise false.

DropUniqueConstraintOnColumnIfExistsAsync ​

Drops a unique constraint on the specified column if it exists.

csharp
Task<bool> DropUniqueConstraintOnColumnIfExistsAsync(IDbConnection db, string schemaName, string tableName, string columnName, IDbTransaction tx, CancellationToken cancellationToken)

Parameters ​

  • db (IDbConnection) - The database connection.
  • schemaName (string) - The schema name.
  • tableName (string) - The table name.
  • columnName (string) - The column name.
  • tx (IDbTransaction) - The transaction to use.
  • cancellationToken (CancellationToken) - The cancellation token.

Returns ​

Type: Task<bool>

True if the unique constraint was dropped, otherwise false.

DoesViewExistAsync ​

Checks if a view exists in the database.

csharp
Task<bool> DoesViewExistAsync(IDbConnection db, string schemaName, string viewName, IDbTransaction tx, CancellationToken cancellationToken)

Parameters ​

  • db (IDbConnection) - The database connection.
  • schemaName (string) - The schema name.
  • viewName (string) - The view name.
  • tx (IDbTransaction) - The transaction.
  • cancellationToken (CancellationToken) - The cancellation token.

Returns ​

Type: Task<bool>

True if the view exists, otherwise false.

CreateViewIfNotExistsAsync ​

Creates a view if it does not exist.

csharp
Task<bool> CreateViewIfNotExistsAsync(IDbConnection db, DmView view, IDbTransaction tx, CancellationToken cancellationToken)

Parameters ​

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

Returns ​

Type: Task<bool>

True if the view was created, otherwise false.

CreateViewIfNotExistsAsync ​

Creates a view if it does not exist.

csharp
Task<bool> CreateViewIfNotExistsAsync(IDbConnection db, string schemaName, string viewName, string definition, IDbTransaction tx, CancellationToken cancellationToken)

Parameters ​

  • db (IDbConnection) - The database connection.
  • schemaName (string) - The schema name.
  • viewName (string) - The view name.
  • definition (string) - The view definition.
  • tx (IDbTransaction) - The transaction.
  • cancellationToken (CancellationToken) - The cancellation token.

Returns ​

Type: Task<bool>

True if the view was created, otherwise false.

GetViewAsync ​

Gets a view from the database.

csharp
Task<DmView?> GetViewAsync(IDbConnection db, string schemaName, string viewName, IDbTransaction tx, CancellationToken cancellationToken)

Parameters ​

  • db (IDbConnection) - The database connection.
  • schemaName (string) - The schema name.
  • viewName (string) - The view name.
  • tx (IDbTransaction) - The transaction.
  • cancellationToken (CancellationToken) - The cancellation token.

Returns ​

Type: Task<DmView?>

The view details, or null if the view does not exist.

GetViewNamesAsync ​

Gets the names of views from the database.

csharp
Task<List<string>> GetViewNamesAsync(IDbConnection db, string schemaName, string viewNameFilter, IDbTransaction tx, CancellationToken cancellationToken)

Parameters ​

  • db (IDbConnection) - The database connection.
  • schemaName (string) - The schema name.
  • viewNameFilter (string) - The view name filter.
  • tx (IDbTransaction) - The transaction.
  • cancellationToken (CancellationToken) - The cancellation token.

Returns ​

Type: Task<List<string>>

A list of view names.

GetViewsAsync ​

Gets views from the database.

csharp
Task<List<DmView>> GetViewsAsync(IDbConnection db, string schemaName, string viewNameFilter, IDbTransaction tx, CancellationToken cancellationToken)

Parameters ​

  • db (IDbConnection) - The database connection.
  • schemaName (string) - The schema name.
  • viewNameFilter (string) - The view name filter.
  • tx (IDbTransaction) - The transaction.
  • cancellationToken (CancellationToken) - The cancellation token.

Returns ​

Type: Task<List<DmView>>

A list of views.

DropViewIfExistsAsync ​

Drops a view if it exists.

csharp
Task<bool> DropViewIfExistsAsync(IDbConnection db, string schemaName, string viewName, IDbTransaction tx, CancellationToken cancellationToken)

Parameters ​

  • db (IDbConnection) - The database connection.
  • schemaName (string) - The schema name.
  • viewName (string) - The view name.
  • tx (IDbTransaction) - The transaction.
  • cancellationToken (CancellationToken) - The cancellation token.

Returns ​

Type: Task<bool>

True if the view was dropped, otherwise false.

RenameViewIfExistsAsync ​

Renames a view if it exists.

csharp
Task<bool> RenameViewIfExistsAsync(IDbConnection db, string schemaName, string viewName, string newViewName, IDbTransaction tx, CancellationToken cancellationToken)

Parameters ​

  • db (IDbConnection) - The database connection.
  • schemaName (string) - The schema name.
  • viewName (string) - The current view name.
  • newViewName (string) - The new view name.
  • tx (IDbTransaction) - The transaction.
  • cancellationToken (CancellationToken) - The cancellation token.

Returns ​

Type: Task<bool>

True if the view was renamed, otherwise false.

GetType ​

csharp
void GetType()

ToString ​

csharp
void ToString()

Equals ​

csharp
void Equals()

GetHashCode ​

csharp
void GetHashCode()

Properties ​

ProviderType ​

Gets the database provider type.

Type: DbProviderType

ProviderTypeMap ​

Gets the provider type map.

Type: IDbProviderTypeMap

SupportsSchemas ​

Gets a value indicating whether the provider supports schemas.

Type: bool

QuoteChars ​

Gets the characters used for quoting identifiers.

Type: char[]