IDatabaseDefaultConstraintMethods ​
Namespace: MJCZone.DapperMatic.Interfaces
Assembly: MJCZone.DapperMatic
Summary ​
Provides database default 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 |
---|---|
CreateDefaultConstraintIfNotExistsAsync | Creates a default constraint if it does not already exist. |
CreateDefaultConstraintIfNotExistsAsync | Creates a default constraint if it does not already exist. |
DoesDefaultConstraintExistOnColumnAsync | Checks if a default constraint exists on a column. |
DoesDefaultConstraintExistAsync | Checks if a default constraint exists. |
GetDefaultConstraintOnColumnAsync | Gets the default constraint on a column. |
GetDefaultConstraintAsync | Gets a default constraint. |
GetDefaultConstraintsAsync | Gets a list of default constraints. |
GetDefaultConstraintNameOnColumnAsync | Gets the name of the default constraint on a column. |
GetDefaultConstraintNamesAsync | Gets a list of default constraint names. |
DropDefaultConstraintOnColumnIfExistsAsync | Drops the default constraint on a column if it exists. |
DropDefaultConstraintIfExistsAsync | Drops a default constraint if it exists. |
CreateDefaultConstraintIfNotExistsAsync ​
Creates a default constraint if it does not already exist.
Task<bool> CreateDefaultConstraintIfNotExistsAsync(IDbConnection db, DmDefaultConstraint constraint, IDbTransaction tx, CancellationToken cancellationToken)
Parameters ​
- db (IDbConnection) - The database connection.
- constraint (DmDefaultConstraint) - The default 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.
CreateDefaultConstraintIfNotExistsAsync ​
Creates a default constraint if it does not already exist.
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 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.
DoesDefaultConstraintExistOnColumnAsync ​
Checks if a default constraint exists on a column.
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 to use, or null.
- cancellationToken (CancellationToken) - The cancellation token.
Returns ​
Type: Task<bool>
True if the constraint exists, false otherwise.
DoesDefaultConstraintExistAsync ​
Checks if a default constraint exists.
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 to use, or null.
- cancellationToken (CancellationToken) - The cancellation token.
Returns ​
Type: Task<bool>
True if the constraint exists, false otherwise.
GetDefaultConstraintOnColumnAsync ​
Gets the default constraint on a column.
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 to use, or null.
- cancellationToken (CancellationToken) - The cancellation token.
Returns ​
Type: Task<DmDefaultConstraint?>
The default constraint, or null if it does not exist.
GetDefaultConstraintAsync ​
Gets a default constraint.
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 to use, or null.
- cancellationToken (CancellationToken) - The cancellation token.
Returns ​
Type: Task<DmDefaultConstraint?>
The default constraint, or null if it does not exist.
GetDefaultConstraintsAsync ​
Gets a list of default constraints.
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 to use, or null.
- cancellationToken (CancellationToken) - The cancellation token.
Returns ​
Type: Task<List<DmDefaultConstraint>>
A list of default constraints.
GetDefaultConstraintNameOnColumnAsync ​
Gets the name of the default constraint on a column.
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 to use, or null.
- cancellationToken (CancellationToken) - The cancellation token.
Returns ​
Type: Task<string?>
The name of the default constraint, or null if it does not exist.
GetDefaultConstraintNamesAsync ​
Gets a list of default constraint names.
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 to use, or null.
- cancellationToken (CancellationToken) - The cancellation token.
Returns ​
Type: Task<List<string>>
A list of default constraint names.
DropDefaultConstraintOnColumnIfExistsAsync ​
Drops the default constraint on a column if it exists.
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 to use, or null.
- cancellationToken (CancellationToken) - The cancellation token.
Returns ​
Type: Task<bool>
True if the constraint was dropped, false otherwise.
DropDefaultConstraintIfExistsAsync ​
Drops a default constraint if it exists.
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 to use, or null.
- cancellationToken (CancellationToken) - The cancellation token.
Returns ​
Type: Task<bool>
True if the constraint was dropped, false otherwise.