DbMigration.Sql Method (String, Boolean, Object)

 

Adds an operation to execute a SQL command. Entity Framework Migrations APIs are not designed to accept input provided by untrusted sources (such as the end user of an application). If input is accepted from such sources it should be validated before being passed to these APIs to protect against SQL injection attacks etc.

Namespace:   System.Data.Entity.Migrations
Assembly:  EntityFramework (in EntityFramework.dll)

[SuppressMessageAttribute("Microsoft.Naming", "CA1719:ParameterNamesShouldNotMatchMemberNames", 
	MessageId = "0#")]
[SuppressMessageAttribute("Microsoft.Design", "CA1026:DefaultParametersShouldNotBeUsed")]
protected internal void Sql(
	string sql,
	bool suppressTransaction = false,
	object anonymousArguments = null
)

Parameters

sql
Type: System.String

The SQL to be executed.

suppressTransaction
Type: System.Boolean

A value indicating if the SQL should be executed outside of the transaction being used for the migration process. If no value is supplied the SQL will be executed within the transaction.

anonymousArguments
Type: System.Object

The additional arguments that may be processed by providers. Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'.