Esempio n. 1
0
        protected void ScriptView(IView view, IScriptWriter writer)
        {
            Throw.If(view, "view").IsNull();
            Throw.If(writer, "writer").IsNull();

            string name = DbObjectName.CreateDbObjectName(view);

            string msg = string.Format("Scripting view {0}", name);

            messageManager.OnScriptMessage(msg);

            SqlScript script = scriptBuilder.Create(view);

            writer.WriteViewScript(name, script.ToScript());
        }
Esempio n. 2
0
        protected virtual void ScriptViews()
        {
            foreach (string viewName in exportParams.ViewsToScript)
            {
                // export current sproc
                SqlView view = database.Views[viewName];
                if (view == null)
                {
                    string msg = string.Format(
                        "Cannot find the view {0} in the database {1}",
                        viewName, database.Name);
                    throw new SqlExporterException(msg);
                }

                // get sproc script with drop statement and comments
                string sql = view.Script(SqlScriptType.Create |
                                         SqlScriptType.Drop |
                                         SqlScriptType.Comments |
                                         SqlScriptType.Permissions);

                writer.WriteViewScript(view.Name, sql);
                UpdateProgress(view.Name);
            }
        }