Share via


DbMigration.SqlResource(String, Assembly, Boolean, Object) Method

Definition

Adds an operation to execute a SQL resource file.

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.

[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1719:ParameterNamesShouldNotMatchMemberNames", MessageId="0#")]
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1026:DefaultParametersShouldNotBeUsed")]
protected internal void SqlResource (string sqlResource, System.Reflection.Assembly resourceAssembly = null, bool suppressTransaction = false, object anonymousArguments = null);
member this.SqlResource : string * System.Reflection.Assembly * bool * obj -> unit
Protected Friend Sub SqlResource (sqlResource As String, Optional resourceAssembly As Assembly = null, Optional suppressTransaction As Boolean = false, Optional anonymousArguments As Object = null)

Parameters

sqlResource
String

The manifest resource name of the SQL resource file to be executed.

resourceAssembly
Assembly

The assembly containing the resource file. The calling assembly is assumed if not provided.

suppressTransaction
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
Object

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

Attributes

Applies to