Exemple #1
0
 public DacCreator(Args args)
 {
     _outputPath = args.DacpacPath;
     _sourceFolder = args.SourcePath;
     _references = args.References;
     _version = args.SqlServerVersion;
     _options = args.SqlModelOptions;
     _preDeployScript = args.PreCompareScript;
     _postDeployScript = args.PostCompareScript;
     if(args.FixDeployScripts)
         ScriptFixer = new DdlScriptParser(_version);
 }
Exemple #2
0
 public DacCreator(Args args)
 {
     _outputPath       = args.DacpacPath;
     _sourceFolder     = args.SourcePath;
     _references       = args.References;
     _version          = args.SqlServerVersion;
     _options          = args.SqlModelOptions;
     _preDeployScript  = args.PreCompareScript;
     _postDeployScript = args.PostCompareScript;
     if (args.FixDeployScripts)
     {
         ScriptFixer = new DdlScriptParser(_version);
     }
 }
Exemple #3
0
        public List<string> GetScripts(DdlScriptParser scriptFixer)
        {
            var scripts = GetScripts(_rootPath);
            if (scriptFixer != null)
            {
                var fixedScripts  = new List<string>();
                foreach (var script in scripts)
                {
                    fixedScripts.AddRange(scriptFixer.GetStatements(script));
                }

                return fixedScripts;
            }

            return scripts;
        }
Exemple #4
0
        public List <string> GetScripts(DdlScriptParser scriptFixer)
        {
            var scripts = GetScripts(_rootPath);

            if (scriptFixer != null)
            {
                var fixedScripts = new List <string>();
                foreach (var script in scripts)
                {
                    fixedScripts.AddRange(scriptFixer.GetStatements(script));
                }

                return(fixedScripts);
            }

            return(scripts);
        }
Exemple #5
0
        public void Turns_Alter_Proc_Into_Create_Proc_Statement()
        {
            var script = @"
            alter procedure do as select 2;
            create table blah(i int)";

            var parser = new DdlScriptParser(SqlServerVersion.Sql120);
            var statements = parser.GetStatements(script);

            Assert.AreEqual(1, statements.Count);
            Assert.AreEqual(@"CREATE PROCEDURE do
            AS
            SELECT 2;
            CREATE TABLE blah (
            i INT
            );", statements.FirstOrDefault());
        }
Exemple #6
0
        public void Finds_Create_Proc_Statement()
        {
            var script = @"if object_id('do') is not null
              begin
            drop procedure do
            end ;
            go
            create procedure do as select 2;
            create table blah(i int)";

            var parser = new DdlScriptParser(SqlServerVersion.Sql100);
            var statements = parser.GetStatements(script);

            Assert.AreEqual(1,statements.Count );
            Assert.AreEqual(@"CREATE PROCEDURE do
            AS
            SELECT 2;
            CREATE TABLE blah (
            i INT
            );", statements.FirstOrDefault());
        }