Esempio n. 1
0
        // Private methods

        private string ReplaceProcedureNameInProcedureText(string newProcedureName)
        {
            Tuple <int, int> procedureNameStartAndLength = ScriptingHelpers.FindStoredProcedureNameInCreateScript(_text);

            int procedureNameStart = procedureNameStartAndLength.Item1;

            return(_text.Remove(procedureNameStart, procedureNameStartAndLength.Item2)
                   .Insert(procedureNameStart, newProcedureName));
        }
Esempio n. 2
0
        public string GenerateDropAndCreateScript(string scriptTemplate, string procedureNameTemplate, bool replaceProcedureNameInProcedureText)
        {
            string procedureName = String.Format(procedureNameTemplate, _schema.Name, _name);

            return(String.Format(
                       scriptTemplate,
                       procedureName,
                       ScriptingHelpers.ConvertBooleanToOnOrOffString(_usesAnsiNulls),
                       ScriptingHelpers.ConvertBooleanToOnOrOffString(_usesQuotedIdentifiers),
                       !replaceProcedureNameInProcedureText ? _text : ReplaceProcedureNameInProcedureText(procedureName)));
        }