src/Shared/EntityFramework/Migrations/DbMigration.cs
/// <summary>
/// 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.
/// </summary>
/// <param name="sqlResource"> The manifest resource name of the SQL resource file to be executed. </param>
/// <param name="resourceAssembly">
/// The assembly containing the resource file. The calling assembly is assumed if not provided.
/// </param>
/// <param name="suppressTransaction">
/// 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.
/// </param>
/// <param name="anonymousArguments">
/// Additional arguments that may be processed by providers. Use anonymous type syntax to
/// specify arguments e.g. 'new { SampleArgument = "MyValue" }'.
/// </param>
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.
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 .
[SuppressMessage("Microsoft.Design", "CA1026:DefaultParametersShouldNotBeUsed")]
        [SuppressMessage("Microsoft.Naming", "CA1719:ParameterNamesShouldNotMatchMemberNames", MessageId = "0#")]
        protected internal void SqlResource(string sqlResource, Assembly resourceAssembly = null, bool suppressTransaction = false, object anonymousArguments = null)
        {
            Check.NotEmpty(sqlResource, "sqlResource");
            resourceAssembly = resourceAssembly ?? Assembly.GetCallingAssembly();
            if (!resourceAssembly.GetManifestResourceNames().Contains(sqlResource))
            {
                throw new ArgumentException(Strings.UnableToLoadEmbeddedResource(resourceAssembly.FullName, sqlResource));
            }
            using (var textStream = new StreamReader(resourceAssembly.GetManifestResourceStream(sqlResource)))
            {
                AddOperation(
                    new SqlOperation(textStream.ReadToEnd(), anonymousArguments)
                    {
                        SuppressTransaction = suppressTransaction
                    });
            }
        }
[ SuppressMessage ( " " , " " ) ] [ SuppressMessage ( " " , " " , MessageId = " " ) ] protected internal void SqlResource ( string sqlResource , Assembly resourceAssembly = null , bool suppressTransaction = false , object anonymousArguments = null ) { Check . NotEmpty ( sqlResource , " " ) ; resourceAssembly = resourceAssembly ?? Assembly . GetCallingAssembly ( ) ; if ( ! resourceAssembly . GetManifestResourceNames ( ) . Contains ( sqlResource ) ) { throw new ArgumentException ( Strings . UnableToLoadEmbeddedResource ( resourceAssembly . FullName , sqlResource ) ) ; } using ( var textStream = new StreamReader ( resourceAssembly . GetManifestResourceStream ( sqlResource ) ) ) { AddOperation ( new SqlOperation ( textStream . ReadToEnd ( ) , anonymousArguments ) { SuppressTransaction = suppressTransaction } ) ; } }
Adds an operation to execute a SQL resource file.
Adds an operation to execute a SQL resource file .
sqlResource
string
The manifest resource name of the SQL resource file to be executed.
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.
The assembly containing the resource file . The calling assembly is assumed if not provided .
suppressTransaction
bool
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.
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" }'.
Additional arguments that may be processed by providers . Use anonymous type syntax to specify arguments e . g . ' new { SampleArgument = " MyValue " } ' .