IDatabaseTable

Ecng.Data

Represents a database table with DDL and DML operations.

Eigenschaften

Name
public string Name { get; }
value = iDatabaseTable.Name

Gets the table name.

Methoden

BulkInsertAsync
public Task BulkInsertAsync(IEnumerable<IDictionary<string, object>> rows, CancellationToken cancellationToken)
result = iDatabaseTable.BulkInsertAsync(rows, cancellationToken)

Inserts multiple rows.

rows
Collection of rows, each row is column values (name -> value).
cancellationToken
Cancellation token.
CreateAsync
public Task CreateAsync(IDictionary<string, Type> columns, CancellationToken cancellationToken)
result = iDatabaseTable.CreateAsync(columns, cancellationToken)

Creates the table if it doesn't exist.

columns
Column definitions (name -> C# type).
cancellationToken
Cancellation token.
DeleteAsync
public Task<int> DeleteAsync(IEnumerable<FilterCondition> filters, CancellationToken cancellationToken)
result = iDatabaseTable.DeleteAsync(filters, cancellationToken)

Deletes rows from the table.

filters
Filter conditions to identify rows to delete.
cancellationToken
Cancellation token.

Rückgabe: Number of deleted rows.

DropAsync
public Task DropAsync(CancellationToken cancellationToken)
result = iDatabaseTable.DropAsync(cancellationToken)

Drops the table if it exists.

cancellationToken
Cancellation token.
InsertAsync
public Task InsertAsync(IDictionary<string, object> values, CancellationToken cancellationToken)
result = iDatabaseTable.InsertAsync(values, cancellationToken)

Inserts a single row.

values
Column values (name -> value).
cancellationToken
Cancellation token.
ModifyAsync
public Task ModifyAsync(IDictionary<string, Type> columns, CancellationToken cancellationToken)
result = iDatabaseTable.ModifyAsync(columns, cancellationToken)

Modifies the table structure by adding columns.

columns
Column definitions to add (name -> C# type).
cancellationToken
Cancellation token.
SelectAsync
public Task<IEnumerable<IDictionary<string, object>>> SelectAsync(IEnumerable<FilterCondition> filters, IEnumerable<OrderByCondition> orderBy, long? skip, long? take, CancellationToken cancellationToken)
result = iDatabaseTable.SelectAsync(filters, orderBy, skip, take, cancellationToken)

Selects rows from the table.

filters
Filter conditions.
orderBy
Order by conditions.
skip
Number of rows to skip.
take
Number of rows to take.
cancellationToken
Cancellation token.

Rückgabe: Selected rows as dictionaries (column name -> value).

UpdateAsync
public Task UpdateAsync(IDictionary<string, object> values, IEnumerable<FilterCondition> filters, CancellationToken cancellationToken)
result = iDatabaseTable.UpdateAsync(values, filters, cancellationToken)

Updates rows in the table.

values
Column values to set (name -> value).
filters
Filter conditions to identify rows to update.
cancellationToken
Cancellation token.
UpsertAsync
public Task UpsertAsync(IDictionary<string, object> values, IEnumerable<string> keyColumns, CancellationToken cancellationToken)
result = iDatabaseTable.UpsertAsync(values, keyColumns, cancellationToken)

Inserts a row if it doesn't exist, or updates it if it does (MERGE/UPSERT).

values
Column values (name -> value).
keyColumns
Key column names used to determine if the row exists.
cancellationToken
Cancellation token.