public override void ExecuteWith(IMigrationProcessor processor)
 {
     // since all the Processors are using String.Format() in their Execute method
     //  we need to escape the brackets with double brackets or else it throws an incorrect format error on the String.Format call
     var sqlText = SqlStatement.Replace("{", "{{").Replace("}", "}}");
     processor.Execute(sqlText);
 }
        public override void ExecuteWith(IMigrationProcessor processor)
        {
            // since all the Processors are using String.Format() in their Execute method
            //  we need to escape the brackets with double brackets or else it throws an incorrect format error on the String.Format call
            var sqlText = SqlStatement.Replace("{", "{{").Replace("}", "}}");

            processor.Execute(sqlText);
        }
        public override void ExecuteWith( IMigrationProcessor processor )
        {
            string sqlText;
            using (var reader = File.OpenText(SqlScript))
                sqlText = reader.ReadToEnd();

            processor.Execute(sqlText);
        }
        public override void ExecuteWith(IMigrationProcessor processor)
        {
            string sqlText;

            using (var reader = File.OpenText(SqlScript))
                sqlText = reader.ReadToEnd();

            processor.Execute(sqlText);
        }
        public override void ExecuteWith( IMigrationProcessor processor )
        {
            string sqlText;
            using (var reader = File.OpenText(SqlScript))
                sqlText = reader.ReadToEnd();

            // since all the Processors are using String.Format() in their Execute method
            //  we need to escape the brackets with double brackets or else it throws an incorrect format error on the String.Format call
            sqlText = sqlText.Replace("{", "{{").Replace("}", "}}");
            processor.Execute(sqlText);
        }
        public override void ExecuteWith(IMigrationProcessor processor)
        {
            string sqlText;

            using (var reader = File.OpenText(SqlScript))
                sqlText = reader.ReadToEnd();

            // since all the Processors are using String.Format() in their Execute method
            //  we need to escape the brackets with double brackets or else it throws an incorrect format error on the String.Format call
            sqlText = sqlText.Replace("{", "{{").Replace("}", "}}");
            processor.Execute(sqlText);
        }
        public override void ExecuteWith(IMigrationProcessor processor)
        {
            string sqlText;
            string embeddedResourceName = GetQualifiedResourcePath();

            using (var stream = MigrationAssembly.GetManifestResourceStream(embeddedResourceName))
            using (var reader = new StreamReader(stream))
            {
                sqlText = reader.ReadToEnd();
            }

            // since all the Processors are using String.Format() in their Execute method
            //  we need to escape the brackets with double brackets or else it throws an incorrect format error on the String.Format call
            sqlText = sqlText.Replace("{", "{{").Replace("}", "}}");
            processor.Execute(sqlText);
        }
        public override void ExecuteWith(IMigrationProcessor processor)
        {
            string sqlText;
            var    embeddedResourceNameWithAssembly = GetQualifiedResourcePath();

            using (var stream = embeddedResourceNameWithAssembly
                                .Assembly.GetManifestResourceStream(embeddedResourceNameWithAssembly.Name))
                using (var reader = new StreamReader(stream))
                {
                    sqlText = reader.ReadToEnd();
                }

            sqlText = SqlScriptTokenReplacer.ReplaceSqlScriptTokens(sqlText, Parameters);

            processor.Execute(sqlText);
        }
示例#9
0
        public override void ExecuteWith(IMigrationProcessor processor)
        {
            string sqlText;
            string embeddedResourceName = GetQualifiedResourcePath();

            using (var stream = MigrationAssembly.GetManifestResourceStream(embeddedResourceName))
                using (var reader = new StreamReader(stream))
                {
                    sqlText = reader.ReadToEnd();
                }

            // since all the Processors are using String.Format() in their Execute method
            //  we need to escape the brackets with double brackets or else it throws an incorrect format error on the String.Format call
            sqlText = sqlText.Replace("{", "{{").Replace("}", "}}");
            processor.Execute(sqlText);
        }
        public override void ExecuteWith(IMigrationProcessor processor)
        {
            string sqlText;
            string embeddedResourceName = GetQualifiedResourcePath(SqlScript);

            if (string.IsNullOrEmpty(embeddedResourceName))
            {
                throw new ArgumentNullException(string.Format("Could find resource named {0} in assembly {1}", SqlScript, MigrationAssembly.FullName));
            }

            using (var stream = MigrationAssembly.GetManifestResourceStream(embeddedResourceName))
            {
                using (var reader = new StreamReader(stream))
                {
                    sqlText = reader.ReadToEnd();
                }
            }

            processor.Execute(sqlText);
        }
        public override void ExecuteWith(IMigrationProcessor processor)
        {
            string sqlText;
            string embeddedResourceName = GetQualifiedResourcePath(SqlScript);

            if (string.IsNullOrEmpty(embeddedResourceName))
            {
                throw new ArgumentNullException(string.Format("Could find resource named {0} in assembly {1}",SqlScript,MigrationAssembly.FullName));
            }

            using (var stream = MigrationAssembly.GetManifestResourceStream(embeddedResourceName))
            {
                using (var reader = new StreamReader(stream))
                {
                    sqlText = reader.ReadToEnd();
                }
            }

            processor.Execute(sqlText);
        }
示例#12
0
        public override void ExecuteWith(IMigrationProcessor processor)
        {
            string sqlText;
            string embeddedResourceName = GetQualifiedResourcePath(SqlScript);

            if (string.IsNullOrEmpty(embeddedResourceName))
            {
                throw new ArgumentNullException(string.Format("Could find resource named {0} in assembly {1}", SqlScript, MigrationAssembly.FullName));
            }

            using (var stream = MigrationAssembly.GetManifestResourceStream(embeddedResourceName))
            {
                using (var reader = new StreamReader(stream))
                {
                    sqlText = reader.ReadToEnd();
                }
            }

            // since all the Processors are using String.Format() in their Execute method
            //  we need to escape the brackets with double brackets or else it throws an incorrect format error on the String.Format call
            sqlText = sqlText.Replace("{", "{{").Replace("}", "}}");
            processor.Execute(sqlText);
        }
        public override void ExecuteWith(IMigrationProcessor processor)
        {
            string sqlText;
            using (var reader = File.OpenText(SqlScript))
                sqlText = reader.ReadToEnd();

            // since all the Processors are using String.Format() in their Execute method
            //	1) we need to escape the brackets with double brackets or else it throws an incorrect format error on the String.Format call
            //	2) we need to replace tokens
            //	3) we need to replace escaped tokens
            sqlText = Regex.Replace(
                Regex.Replace(
                    sqlText.Replace("{", "{{").Replace("}", "}}"),
                    @"\$\((?<token>\w+)\)",
                    m => ((Parameters != null) && Parameters.ContainsKey(m.Groups["token"].Value))
                        ? Parameters[m.Groups["token"].Value]
                        : ""),
                @"\${2}\({2}(?<token>\w+)\){2}",
                m => string.Format("$({0})", m.Groups["token"]));

            // adding ability to pass parameters to execute function
            processor.Execute(sqlText);
        }
 public override void ExecuteWith(IMigrationProcessor processor)
 {
     processor.Execute(SqlStatement);
 }
 /// <inheritdoc />
 public override void ExecuteWith(IMigrationProcessor processor)
 {
     processor.Execute(SqlStatement);
 }
        /// <summary>
        /// Executes the <paramref name="sqlScript"/> with the given <paramref name="processor"/>
        /// </summary>
        /// <param name="processor">The processor to execute the script with</param>
        /// <param name="sqlScript">The SQL script to execute</param>
        protected void Execute(IMigrationProcessor processor, string sqlScript)
        {
            var finalSqlScript = SqlScriptTokenReplacer.ReplaceSqlScriptTokens(sqlScript, Parameters);

            processor.Execute(finalSqlScript);
        }