IDatabaseViewMethods
Namespace: MJCZone.DapperMatic.Interfaces
Assembly: MJCZone.DapperMatic
Summary
Provides database view 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 (8)
Methods
| Method | Summary |
|---|---|
| DoesViewExistAsync | Checks if a view exists in the database. |
| CreateViewIfNotExistsAsync | Creates a view if it does not exist. |
| CreateViewIfNotExistsAsync | Creates a view if it does not exist. |
| GetViewAsync | Gets a view from the database. |
| GetViewsAsync | Gets a list of views from the database. |
| GetViewNamesAsync | Gets a list of view names from the database. |
| DropViewIfExistsAsync | Drops a view if it exists. |
| RenameViewIfExistsAsync | Renames a view if it exists. |
DoesViewExistAsync
Checks if a view exists in the database.
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 database 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.
Task<bool> CreateViewIfNotExistsAsync(
IDbConnection db,
DmView view,
IDbTransaction tx,
CancellationToken cancellationToken)Parameters
- db (IDbConnection) - The database connection.
- view (DmView) - The view definition.
- tx (IDbTransaction) - The database 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.
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 database 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.
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 database transaction.
- cancellationToken (CancellationToken) - The cancellation token.
Returns
Type: Task<DmView?>
The view if found, otherwise null.
GetViewsAsync
Gets a list of views from the database.
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 database transaction.
- cancellationToken (CancellationToken) - The cancellation token.
Returns
Type: Task<List<DmView>>
A list of views.
GetViewNamesAsync
Gets a list of view names from the database.
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 database transaction.
- cancellationToken (CancellationToken) - The cancellation token.
Returns
Type: Task<List<string>>
A list of view names.
DropViewIfExistsAsync
Drops a view if it exists.
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 database 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.
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 view name.
- newViewName (string) - The new view name.
- tx (IDbTransaction) - The database transaction.
- cancellationToken (CancellationToken) - The cancellation token.
Returns
Type: Task<bool>
True if the view was renamed, otherwise false.