DatabaseCommand

Ecng.Data

Wraps a DbCommand and provides execution methods for database operations.

継承元: Disposable

プロパティ

CommandText
public string CommandText { get; }
value = databaseCommand.CommandText

Gets the SQL command text.

CommandType
public CommandType CommandType { get; }
value = databaseCommand.CommandType

Gets the command type (text, stored procedure, etc.).

Parameters
public DbParameterCollection Parameters { get; }
value = databaseCommand.Parameters

Gets the collection of command parameters.

メソッド

DisposeManaged
protected override void DisposeManaged()
databaseCommand.DisposeManaged()

Disposes the managed resources. Override this method to add custom clean up of managed resources.

ExecuteNonQuery
public ValueTask<int> ExecuteNonQuery(IEnumerable<SerializationItem> input, CancellationToken cancellationToken)
result = databaseCommand.ExecuteNonQuery(input, cancellationToken)

Executes the command and returns the number of rows affected.

ExecuteRow
public ValueTask<SerializationItemCollection> ExecuteRow(IEnumerable<SerializationItem> input, CancellationToken cancellationToken)
result = databaseCommand.ExecuteRow(input, cancellationToken)

Executes the command and returns the first result row as a serialization item collection.

ExecuteRowsAsync
public IAsyncEnumerable<SerializationItemCollection> ExecuteRowsAsync(SerializationItemCollection input, CancellationToken cancellationToken)
result = databaseCommand.ExecuteRowsAsync(input, cancellationToken)

Streams result rows one at a time without buffering the whole set in memory — preferred over CancellationToken) for queries that may return millions of rows.

ExecuteScalar``1
public ValueTask<TScalar> ExecuteScalar<TScalar>(IEnumerable<SerializationItem> input, CancellationToken cancellationToken)
result = databaseCommand.ExecuteScalar(input, cancellationToken)

Executes the command and returns the first column of the first row as the specified type.

ExecuteTable
public ValueTask<SerializationItemCollection> ExecuteTable(SerializationItemCollection input, CancellationToken cancellationToken)
result = databaseCommand.ExecuteTable(input, cancellationToken)

Executes the command and returns all result rows as a columnar serialization item collection. Loads the entire result set into memory; for arbitrarily-large reads use CancellationToken).