Interface IRelationalCommand
- Namespace
- Microsoft.EntityFrameworkCore.Storage
- Assembly
- Microsoft.EntityFrameworkCore.Relational.dll
A command to be executed against a relational database.
This type is typically used by database providers (and other extensions). It is generally not used in application code.
public interface IRelationalCommand
Properties
CommandText
Gets the command text to be executed.
string CommandText { get; }
Property Value
Parameters
Gets the parameters for the command.
IReadOnlyList<IRelationalParameter> Parameters { get; }
Property Value
Methods
CreateDbCommand(RelationalCommandParameterObject, Guid, DbCommandMethod)
Called by the execute methods to create a DbCommand for the given DbConnection and configure timeouts and transactions.
This method is typically used by database providers (and other extensions). It is generally not used in application code.
DbCommand CreateDbCommand(RelationalCommandParameterObject parameterObject, Guid commandId, DbCommandMethod commandMethod)
Parameters
parameterObject
RelationalCommandParameterObjectParameters for this method.
commandId
GuidThe command correlation ID.
commandMethod
DbCommandMethodThe method that will be called on the created command.
Returns
- DbCommand
The created command.
ExecuteNonQuery(RelationalCommandParameterObject)
Executes the command with no results.
int ExecuteNonQuery(RelationalCommandParameterObject parameterObject)
Parameters
parameterObject
RelationalCommandParameterObjectParameters for this method.
Returns
- int
The number of rows affected.
ExecuteNonQueryAsync(RelationalCommandParameterObject, CancellationToken)
Asynchronously executes the command with no results.
Task<int> ExecuteNonQueryAsync(RelationalCommandParameterObject parameterObject, CancellationToken cancellationToken = default)
Parameters
parameterObject
RelationalCommandParameterObjectParameters for this method.
cancellationToken
CancellationTokenA CancellationToken to observe while waiting for the task to complete.
Returns
- Task<int>
A task that represents the asynchronous operation. The task result contains the number of rows affected.
ExecuteReader(RelationalCommandParameterObject)
Executes the command with a RelationalDataReader result.
RelationalDataReader ExecuteReader(RelationalCommandParameterObject parameterObject)
Parameters
parameterObject
RelationalCommandParameterObjectParameters for this method.
Returns
- RelationalDataReader
The result of the command.
ExecuteReaderAsync(RelationalCommandParameterObject, CancellationToken)
Asynchronously executes the command with a RelationalDataReader result.
Task<RelationalDataReader> ExecuteReaderAsync(RelationalCommandParameterObject parameterObject, CancellationToken cancellationToken = default)
Parameters
parameterObject
RelationalCommandParameterObjectParameters for this method.
cancellationToken
CancellationTokenA CancellationToken to observe while waiting for the task to complete.
Returns
- Task<RelationalDataReader>
A task that represents the asynchronous operation. The task result contains the result of the command.
ExecuteScalar(RelationalCommandParameterObject)
Executes the command with a single scalar result.
object ExecuteScalar(RelationalCommandParameterObject parameterObject)
Parameters
parameterObject
RelationalCommandParameterObjectParameters for this method.
Returns
- object
The result of the command.
ExecuteScalarAsync(RelationalCommandParameterObject, CancellationToken)
Asynchronously executes the command with a single scalar result.
Task<object> ExecuteScalarAsync(RelationalCommandParameterObject parameterObject, CancellationToken cancellationToken = default)
Parameters
parameterObject
RelationalCommandParameterObjectParameters for this method.
cancellationToken
CancellationTokenA CancellationToken to observe while waiting for the task to complete.