Skip to content

IDatabaseIndexMethods ​

Namespace: MJCZone.DapperMatic.Interfaces

Assembly: MJCZone.DapperMatic

Summary ​

Provides database index 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 ​

MethodSummary
CreateIndexIfNotExistsAsyncCreates an index if it does not already exist.
CreateIndexIfNotExistsAsyncCreates an index if it does not already exist.
DoesIndexExistOnColumnAsyncChecks if an index exists on a specific column.
DoesIndexExistAsyncChecks if an index exists.
GetIndexesOnColumnAsyncGets the indexes on a specific column.
GetIndexAsyncGets a specific index.
GetIndexesAsyncGets the indexes.
GetIndexNamesOnColumnAsyncGets the index names on a specific column.
GetIndexNamesAsyncGets the index names.
DropIndexesOnColumnIfExistsAsyncDrops the indexes on a specific column if they exist.
DropIndexIfExistsAsyncDrops an index if it exists.

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.
  • tx (IDbTransaction) - The database transaction.
  • cancellationToken (CancellationToken) - The cancellation token.

Returns ​

Type: Task<bool>

A task that represents the asynchronous operation. The task result contains a boolean indicating success.

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 be indexed.
  • isUnique (bool) - Indicates whether the index is unique.
  • tx (IDbTransaction) - The database transaction.
  • cancellationToken (CancellationToken) - The cancellation token.

Returns ​

Type: Task<bool>

A task that represents the asynchronous operation. The task result contains a boolean indicating success.

DoesIndexExistOnColumnAsync ​

Checks if an index exists on a specific column.

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 database transaction.
  • cancellationToken (CancellationToken) - The cancellation token.

Returns ​

Type: Task<bool>

A task that represents the asynchronous operation. The task result contains a boolean indicating existence.

DoesIndexExistAsync ​

Checks if an index exists.

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 database transaction.
  • cancellationToken (CancellationToken) - The cancellation token.

Returns ​

Type: Task<bool>

A task that represents the asynchronous operation. The task result contains a boolean indicating existence.

GetIndexesOnColumnAsync ​

Gets the indexes on a specific column.

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 database transaction.
  • cancellationToken (CancellationToken) - The cancellation token.

Returns ​

Type: Task<List<DmIndex>>

A task that represents the asynchronous operation. The task result contains a list of indexes.

GetIndexAsync ​

Gets a specific index.

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 database transaction.
  • cancellationToken (CancellationToken) - The cancellation token.

Returns ​

Type: Task<DmIndex?>

A task that represents the asynchronous operation. The task result contains the index.

GetIndexesAsync ​

Gets the indexes.

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) - The index name filter.
  • tx (IDbTransaction) - The database transaction.
  • cancellationToken (CancellationToken) - The cancellation token.

Returns ​

Type: Task<List<DmIndex>>

A task that represents the asynchronous operation. The task result contains a list of indexes.

GetIndexNamesOnColumnAsync ​

Gets the index names on a specific column.

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 database transaction.
  • cancellationToken (CancellationToken) - The cancellation token.

Returns ​

Type: Task<List<string>>

A task that represents the asynchronous operation. The task result contains a list of index names.

GetIndexNamesAsync ​

Gets the index names.

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) - The index name filter.
  • tx (IDbTransaction) - The database transaction.
  • cancellationToken (CancellationToken) - The cancellation token.

Returns ​

Type: Task<List<string>>

A task that represents the asynchronous operation. The task result contains a list of index names.

DropIndexesOnColumnIfExistsAsync ​

Drops the indexes on a specific column if they exist.

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 database transaction.
  • cancellationToken (CancellationToken) - The cancellation token.

Returns ​

Type: Task<bool>

A task that represents the asynchronous operation. The task result contains a boolean indicating success.

DropIndexIfExistsAsync ​

Drops an index if it exists.

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 database transaction.
  • cancellationToken (CancellationToken) - The cancellation token.

Returns ​

Type: Task<bool>

A task that represents the asynchronous operation. The task result contains a boolean indicating success.