Skip to content

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 ​

MethodSummary
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.
GetViewsAsyncGets a list of views from the database.
GetViewNamesAsyncGets a list of view names from the database.
DropViewIfExistsAsyncDrops a view if it exists.
RenameViewIfExistsAsyncRenames a view if it exists.

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 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.

csharp
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.

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 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.

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 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.

csharp
Task&lt;List&lt;DmView&gt;&gt; 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.

csharp
Task&lt;List&lt;string&gt;&gt; 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&lt;List&lt;string&gt;&gt;

A list of view names.

DropViewIfExistsAsync ​

Drops a view if it exists.

csharp
Task&lt;bool&gt; 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&lt;bool&gt;

True if the view was dropped, otherwise false.

RenameViewIfExistsAsync ​

Renames a view if it exists.

csharp
Task&lt;bool&gt; 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&lt;bool&gt;

True if the view was renamed, otherwise false.