IDatabaseCheckConstraintMethods ​
Namespace: MJCZone.DapperMatic.Interfaces
Assembly: MJCZone.DapperMatic
Summary ​
Provides database check constraint methods for database operations.
abstract
public
Note: This is an interface that defines a contract. Look for implementing classes in the same or related namespaces.
Contents ​
Methods (11)
Methods ​
Method | Summary |
---|---|
CreateCheckConstraintIfNotExistsAsync | Creates a check constraint if it does not already exist. |
CreateCheckConstraintIfNotExistsAsync | Creates a check constraint if it does not already exist. |
DoesCheckConstraintExistOnColumnAsync | Checks if a check constraint exists on a column. |
DoesCheckConstraintExistAsync | Checks if a check constraint exists. |
GetCheckConstraintOnColumnAsync | Gets the check constraint on a column. |
GetCheckConstraintAsync | Gets the check constraint. |
GetCheckConstraintsAsync | Gets a list of check constraints. |
GetCheckConstraintNameOnColumnAsync | Gets the name of the check constraint on a column. |
GetCheckConstraintNamesAsync | Gets a list of check constraint names. |
DropCheckConstraintOnColumnIfExistsAsync | Drops a check constraint on a column if it exists. |
DropCheckConstraintIfExistsAsync | Drops a check constraint if it exists. |
CreateCheckConstraintIfNotExistsAsync ​
Creates a check constraint if it does not already exist.
Task<bool> CreateCheckConstraintIfNotExistsAsync(IDbConnection db, DmCheckConstraint constraint, IDbTransaction tx, CancellationToken cancellationToken)
Parameters ​
- db (IDbConnection) - The database connection.
- constraint (DmCheckConstraint) - The check constraint to create.
- tx (IDbTransaction) - The transaction to use, or null.
- cancellationToken (CancellationToken) - The cancellation token.
Returns ​
Type: Task<bool>
True if the constraint was created, false otherwise.
CreateCheckConstraintIfNotExistsAsync ​
Creates a check constraint if it does not already exist.
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 constraint expression.
- tx (IDbTransaction) - The transaction to use, or null.
- cancellationToken (CancellationToken) - The cancellation token.
Returns ​
Type: Task<bool>
True if the constraint was created, false otherwise.
DoesCheckConstraintExistOnColumnAsync ​
Checks if a check constraint exists on a column.
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 to use, or null.
- cancellationToken (CancellationToken) - The cancellation token.
Returns ​
Type: Task<bool>
True if the constraint exists, false otherwise.
DoesCheckConstraintExistAsync ​
Checks if a check constraint exists.
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 to use, or null.
- cancellationToken (CancellationToken) - The cancellation token.
Returns ​
Type: Task<bool>
True if the constraint exists, false otherwise.
GetCheckConstraintOnColumnAsync ​
Gets the check constraint on a column.
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 to use, or null.
- cancellationToken (CancellationToken) - The cancellation token.
Returns ​
Type: Task<DmCheckConstraint?>
The check constraint, or null if it does not exist.
GetCheckConstraintAsync ​
Gets the check constraint.
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 to use, or null.
- cancellationToken (CancellationToken) - The cancellation token.
Returns ​
Type: Task<DmCheckConstraint?>
The check constraint, or null if it does not exist.
GetCheckConstraintsAsync ​
Gets a list of check constraints.
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 to use, or null.
- cancellationToken (CancellationToken) - The cancellation token.
Returns ​
Type: Task<List<DmCheckConstraint>>
A list of check constraints.
GetCheckConstraintNameOnColumnAsync ​
Gets the name of the check constraint on a column.
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 to use, or null.
- cancellationToken (CancellationToken) - The cancellation token.
Returns ​
Type: Task<string?>
The name of the check constraint, or null if it does not exist.
GetCheckConstraintNamesAsync ​
Gets a list of check constraint names.
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 to use, or null.
- cancellationToken (CancellationToken) - The cancellation token.
Returns ​
Type: Task<List<string>>
A list of check constraint names.
DropCheckConstraintOnColumnIfExistsAsync ​
Drops a check constraint on a column if it exists.
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 to use, or null.
- cancellationToken (CancellationToken) - The cancellation token.
Returns ​
Type: Task<bool>
True if the constraint was dropped, false otherwise.
DropCheckConstraintIfExistsAsync ​
Drops a check constraint if it exists.
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 to use, or null.
- cancellationToken (CancellationToken) - The cancellation token.
Returns ​
Type: Task<bool>
True if the constraint was dropped, false otherwise.