RelationalDatabaseFacadeExtensions.ExecuteSqlCommand RelationalDatabaseFacadeExtensions.ExecuteSqlCommand Method

Definition

Overloads

ExecuteSqlCommand(DatabaseFacade, FormattableString) ExecuteSqlCommand(DatabaseFacade, FormattableString)

Executes the given SQL against the database and returns the number of rows affected.

Note that this method does not start a transaction. To use this method with a transaction, first call BeginTransaction(DatabaseFacade, IsolationLevel) or UseTransaction(DatabaseFacade, DbTransaction).

Note that the current ExecutionStrategy is not used by this method since the SQL may not be idempotent and does not run in a transaction. An ExecutionStrategy can be used explicitly, making sure to also use a transaction if the SQL is not idempotent.

ExecuteSqlCommand(DatabaseFacade, RawSqlString, IEnumerable<Object>) ExecuteSqlCommand(DatabaseFacade, RawSqlString, IEnumerable<Object>)

Executes the given SQL against the database and returns the number of rows affected.

Note that this method does not start a transaction. To use this method with a transaction, first call BeginTransaction(DatabaseFacade, IsolationLevel) or UseTransaction(DatabaseFacade, DbTransaction).

Note that the current ExecutionStrategy is not used by this method since the SQL may not be idempotent and does not run in a transaction. An ExecutionStrategy can be used explicitly, making sure to also use a transaction if the SQL is not idempotent.

ExecuteSqlCommand(DatabaseFacade, RawSqlString, Object[]) ExecuteSqlCommand(DatabaseFacade, RawSqlString, Object[])

Executes the given SQL against the database and returns the number of rows affected.

Note that this method does not start a transaction. To use this method with a transaction, first call BeginTransaction(DatabaseFacade, IsolationLevel) or UseTransaction(DatabaseFacade, DbTransaction).

Note that the current ExecutionStrategy is not used by this method since the SQL may not be idempotent and does not run in a transaction. An ExecutionStrategy can be used explicitly, making sure to also use a transaction if the SQL is not idempotent.

ExecuteSqlCommand(DatabaseFacade, String, Object[]) ExecuteSqlCommand(DatabaseFacade, String, Object[])

ExecuteSqlCommand(DatabaseFacade, FormattableString) ExecuteSqlCommand(DatabaseFacade, FormattableString)

Executes the given SQL against the database and returns the number of rows affected.

Note that this method does not start a transaction. To use this method with a transaction, first call BeginTransaction(DatabaseFacade, IsolationLevel) or UseTransaction(DatabaseFacade, DbTransaction).

Note that the current ExecutionStrategy is not used by this method since the SQL may not be idempotent and does not run in a transaction. An ExecutionStrategy can be used explicitly, making sure to also use a transaction if the SQL is not idempotent.

public static int ExecuteSqlCommand (this Microsoft.EntityFrameworkCore.Infrastructure.DatabaseFacade databaseFacade, FormattableString sql);
static member ExecuteSqlCommand : Microsoft.EntityFrameworkCore.Infrastructure.DatabaseFacade * FormattableString -> int

Parameters

databaseFacade
DatabaseFacade DatabaseFacade

The DatabaseFacade for the context.

sql
FormattableString FormattableString

The interpolated string representing a SQL query with parameters.

Returns

The number of rows affected.

ExecuteSqlCommand(DatabaseFacade, RawSqlString, IEnumerable<Object>) ExecuteSqlCommand(DatabaseFacade, RawSqlString, IEnumerable<Object>)

Executes the given SQL against the database and returns the number of rows affected.

Note that this method does not start a transaction. To use this method with a transaction, first call BeginTransaction(DatabaseFacade, IsolationLevel) or UseTransaction(DatabaseFacade, DbTransaction).

Note that the current ExecutionStrategy is not used by this method since the SQL may not be idempotent and does not run in a transaction. An ExecutionStrategy can be used explicitly, making sure to also use a transaction if the SQL is not idempotent.

public static int ExecuteSqlCommand (this Microsoft.EntityFrameworkCore.Infrastructure.DatabaseFacade databaseFacade, Microsoft.EntityFrameworkCore.RawSqlString sql, System.Collections.Generic.IEnumerable<object> parameters);
static member ExecuteSqlCommand : Microsoft.EntityFrameworkCore.Infrastructure.DatabaseFacade * Microsoft.EntityFrameworkCore.RawSqlString * seq<obj> -> int

Parameters

databaseFacade
DatabaseFacade DatabaseFacade

The DatabaseFacade for the context.

sql
RawSqlString RawSqlString

The SQL to execute.

parameters
IEnumerable<Object>

Parameters to use with the SQL.

Returns

The number of rows affected.

ExecuteSqlCommand(DatabaseFacade, RawSqlString, Object[]) ExecuteSqlCommand(DatabaseFacade, RawSqlString, Object[])

Executes the given SQL against the database and returns the number of rows affected.

Note that this method does not start a transaction. To use this method with a transaction, first call BeginTransaction(DatabaseFacade, IsolationLevel) or UseTransaction(DatabaseFacade, DbTransaction).

Note that the current ExecutionStrategy is not used by this method since the SQL may not be idempotent and does not run in a transaction. An ExecutionStrategy can be used explicitly, making sure to also use a transaction if the SQL is not idempotent.

public static int ExecuteSqlCommand (this Microsoft.EntityFrameworkCore.Infrastructure.DatabaseFacade databaseFacade, Microsoft.EntityFrameworkCore.RawSqlString sql, params object[] parameters);
static member ExecuteSqlCommand : Microsoft.EntityFrameworkCore.Infrastructure.DatabaseFacade * Microsoft.EntityFrameworkCore.RawSqlString * obj[] -> int

Parameters

databaseFacade
DatabaseFacade DatabaseFacade

The DatabaseFacade for the context.

sql
RawSqlString RawSqlString

The SQL to execute.

parameters
Object[]

Parameters to use with the SQL.

Returns

The number of rows affected.

ExecuteSqlCommand(DatabaseFacade, String, Object[]) ExecuteSqlCommand(DatabaseFacade, String, Object[])

public static int ExecuteSqlCommand (this Microsoft.EntityFrameworkCore.Infrastructure.DatabaseFacade databaseFacade, string sql, params object[] parameters);
static member ExecuteSqlCommand : Microsoft.EntityFrameworkCore.Infrastructure.DatabaseFacade * string * obj[] -> int

Parameters

parameters
Object[]

Returns

Applies to