コード例 #1
0
        public ScriptStepCollection GenerateScript(IScriptExecuteCallback callback, string server, string userId, string password, string database, bool dropAllConstraints, string collation, FullTextLanguage language, bool setSingleUser)
        {
            SqlConnection connection = new SqlConnection();
            connection.ConnectionString = Utils.ConnectionString(server, userId, password, 2, database);

            try
            {
                connection.Open();
                ScriptStepCollection script = LoadScript(new Version(connection.ServerVersion), database, dropAllConstraints, collation, language, setSingleUser);
                //now get the last script entry and replace it with
                //a special component that will return out

                ScriptStepGenerateScript generator = new ScriptStepGenerateScript(script[script.Count - 1]);
                script[script.Count - 1] = generator;
                script.Execute(connection, callback);
                return generator.Script;
            }
            finally
            {
                connection.Dispose();
            }
        }
コード例 #2
0
        public ScriptStepCollection GenerateScript(IScriptExecuteCallback callback, string server, string userId, string password, string database, bool dropAllConstraints, string collation, FullTextLanguage language, bool setSingleUser)
        {
            SqlConnection connection = new SqlConnection();

            connection.ConnectionString = Utils.ConnectionString(server, userId, password);

            try
            {
                connection.Open();
                ScriptStepCollection script = LoadScript(new Version(connection.ServerVersion), database, dropAllConstraints, collation, language, setSingleUser);
                //now get the last script entry and replace it with
                //a special component that will return out

                ScriptStepGenerateScript generator = new ScriptStepGenerateScript(script[script.Count - 1]);
                script[script.Count - 1] = generator;
                script.Execute(connection, callback);
                return(generator.Script);
            }
            finally
            {
                connection.Dispose();
            }
        }