IRelationalCommand IRelationalCommand Interface

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.

Syntax

Declaration

public interface IRelationalCommandPublic Interface IRelationalCommand

Properties summary

Gets the command text to be executed.

Gets the parameters for the command.

Methods summary

Executes the command with no results.

Asynchronously executes the command with no results.

Executes the command with a RelationalDataReader result.

Asynchronously executes the command with a RelationalDataReader result.

Executes the command with a single scalar result.

Asynchronously executes the command with a single scalar result.

Properties

  • CommandText
    CommandText

    Gets the command text to be executed.

    string CommandText { get; }ReadOnly Property CommandText As String

    Property Value

    • System.String
      System.String
  • Parameters
    Parameters

    Gets the parameters for the command.

    IReadOnlyList<IRelationalParameter> Parameters { get; }ReadOnly Property Parameters As IReadOnlyList(Of IRelationalParameter)

    Property Value

Methods

  • ExecuteNonQuery(IRelationalConnection, IReadOnlyDictionary<String, Object>)
    ExecuteNonQuery(IRelationalConnection, IReadOnlyDictionary(Of String, Object))

    Executes the command with no results.

    int ExecuteNonQuery(IRelationalConnection connection, IReadOnlyDictionary<string, object> parameterValues)Function ExecuteNonQuery(connection As IRelationalConnection, parameterValues As IReadOnlyDictionary(Of String, Object)) As Integer

    Parameters

    • connection

      The connection to execute against.

    • parameterValues
      System.Collections.Generic.IReadOnlyDictionary<TKey, TValue><System.String, System.Object>
      System.Collections.Generic.IReadOnlyDictionary<TKey, TValue>(Of System.String, System.Object)

      The values for the parameters.

    Returns

    • System.Int32
      System.Int32

      The number of rows affected.

  • ExecuteNonQueryAsync(IRelationalConnection, IReadOnlyDictionary<String, Object>, CancellationToken)
    ExecuteNonQueryAsync(IRelationalConnection, IReadOnlyDictionary(Of String, Object), CancellationToken)

    Asynchronously executes the command with no results.

    Task<int> ExecuteNonQueryAsync(IRelationalConnection connection, IReadOnlyDictionary<string, object> parameterValues, CancellationToken cancellationToken = null)Function ExecuteNonQueryAsync(connection As IRelationalConnection, parameterValues As IReadOnlyDictionary(Of String, Object), cancellationToken As CancellationToken = Nothing) As Task(Of Integer)

    Parameters

    • connection

      The connection to execute against.

    • parameterValues
      System.Collections.Generic.IReadOnlyDictionary<TKey, TValue><System.String, System.Object>
      System.Collections.Generic.IReadOnlyDictionary<TKey, TValue>(Of System.String, System.Object)

      The values for the parameters.

    • cancellationToken
      System.Threading.CancellationToken
      System.Threading.CancellationToken

      A System.Threading.CancellationToken to observe while waiting for the task to complete.

    Returns

    • System.Threading.Tasks.Task<TResult><System.Int32>
      System.Threading.Tasks.Task<TResult>(Of System.Int32)

      A task that represents the asynchronous operation. The task result contains the number of rows affected.

  • ExecuteReader(IRelationalConnection, IReadOnlyDictionary<String, Object>)
    ExecuteReader(IRelationalConnection, IReadOnlyDictionary(Of String, Object))

    Executes the command with a RelationalDataReader result.

    RelationalDataReader ExecuteReader(IRelationalConnection connection, IReadOnlyDictionary<string, object> parameterValues)Function ExecuteReader(connection As IRelationalConnection, parameterValues As IReadOnlyDictionary(Of String, Object)) As RelationalDataReader

    Parameters

    • connection

      The connection to execute against.

    • parameterValues
      System.Collections.Generic.IReadOnlyDictionary<TKey, TValue><System.String, System.Object>
      System.Collections.Generic.IReadOnlyDictionary<TKey, TValue>(Of System.String, System.Object)

      The values for the parameters.

    Returns

  • ExecuteReaderAsync(IRelationalConnection, IReadOnlyDictionary<String, Object>, CancellationToken)
    ExecuteReaderAsync(IRelationalConnection, IReadOnlyDictionary(Of String, Object), CancellationToken)

    Asynchronously executes the command with a RelationalDataReader result.

    Task<RelationalDataReader> ExecuteReaderAsync(IRelationalConnection connection, IReadOnlyDictionary<string, object> parameterValues, CancellationToken cancellationToken = null)Function ExecuteReaderAsync(connection As IRelationalConnection, parameterValues As IReadOnlyDictionary(Of String, Object), cancellationToken As CancellationToken = Nothing) As Task(Of RelationalDataReader)

    Parameters

    • connection

      The connection to execute against.

    • parameterValues
      System.Collections.Generic.IReadOnlyDictionary<TKey, TValue><System.String, System.Object>
      System.Collections.Generic.IReadOnlyDictionary<TKey, TValue>(Of System.String, System.Object)

      The values for the parameters.

    • cancellationToken
      System.Threading.CancellationToken
      System.Threading.CancellationToken

      A System.Threading.CancellationToken to observe while waiting for the task to complete.

    Returns

    • System.Threading.Tasks.Task<TResult><RelationalDataReader>
      System.Threading.Tasks.Task<TResult>(Of RelationalDataReader)

      A task that represents the asynchronous operation. The task result contains the result of the command.

  • ExecuteScalar(IRelationalConnection, IReadOnlyDictionary<String, Object>)
    ExecuteScalar(IRelationalConnection, IReadOnlyDictionary(Of String, Object))

    Executes the command with a single scalar result.

    object ExecuteScalar(IRelationalConnection connection, IReadOnlyDictionary<string, object> parameterValues)Function ExecuteScalar(connection As IRelationalConnection, parameterValues As IReadOnlyDictionary(Of String, Object)) As Object

    Parameters

    • connection

      The connection to execute against.

    • parameterValues
      System.Collections.Generic.IReadOnlyDictionary<TKey, TValue><System.String, System.Object>
      System.Collections.Generic.IReadOnlyDictionary<TKey, TValue>(Of System.String, System.Object)

      The values for the parameters.

    Returns

    • System.Object
      System.Object

      The result of the command.

  • ExecuteScalarAsync(IRelationalConnection, IReadOnlyDictionary<String, Object>, CancellationToken)
    ExecuteScalarAsync(IRelationalConnection, IReadOnlyDictionary(Of String, Object), CancellationToken)

    Asynchronously executes the command with a single scalar result.

    Task<object> ExecuteScalarAsync(IRelationalConnection connection, IReadOnlyDictionary<string, object> parameterValues, CancellationToken cancellationToken = null)Function ExecuteScalarAsync(connection As IRelationalConnection, parameterValues As IReadOnlyDictionary(Of String, Object), cancellationToken As CancellationToken = Nothing) As Task(Of Object)

    Parameters

    • connection

      The connection to execute against.

    • parameterValues
      System.Collections.Generic.IReadOnlyDictionary<TKey, TValue><System.String, System.Object>
      System.Collections.Generic.IReadOnlyDictionary<TKey, TValue>(Of System.String, System.Object)

      The values for the parameters.

    • cancellationToken
      System.Threading.CancellationToken
      System.Threading.CancellationToken

      A System.Threading.CancellationToken to observe while waiting for the task to complete.

    Returns

    • System.Threading.Tasks.Task<TResult><System.Object>
      System.Threading.Tasks.Task<TResult>(Of System.Object)

      A task that represents the asynchronous operation. The task result contains the result of the command.

Details

Assembly

Microsoft.EntityFrameworkCore.Relational.dll