Пример #1
0
        public void ShouldScriptAllViews()
        {
            IList <DbObjectName> views = engine.GetAllViews(connSettings);

            ScriptingOptions options = new ScriptingOptions();

            options.ExportDirectory = exportDir;
            options.AddViewsToScript(views);

            engine.Script(connSettings, options);

            string dataPath = Path.Combine(exportDir, "Views");

            Assert.IsTrue(File.Exists(Path.Combine(dataPath, "dbo.CustomerAndPrimaryAddress.sql")), "CustomerAndPrimaryAddress script missing");
        }
Пример #2
0
        public void ShouldScriptEverythingToSingleScript()
        {
            IList <DbObjectName> views  = engine.GetAllViews(connSettings);
            IList <DbObjectName> sprocs = engine.GetAllSprocs(connSettings);
            IList <DbObjectName> tables = engine.GetAllTables(connSettings);

            ScriptingOptions options = new ScriptingOptions();

            options.ExportDirectory = exportDir;
            options.AddTablesToScript(tables);
            options.AddSprocsToScript(sprocs);
            options.AddViewsToScript(views);
            options.ScriptData        = true;
            options.ScriptForeignKeys = true;
            options.ScriptIndexes     = true;
            options.ScriptSchema      = true;
            options.UseMultipleFiles  = false;

            engine.Script(connSettings, options);

            Assert.IsTrue(File.Exists(Path.Combine(exportDir, "SqlMigration1.sql")));
        }