Exemple #1
0
        public void WriteAll()
        {
            var path = @"C:\source\temp\db\sql\HackDay\RedGateScripts";

            var atom = AtomCreator.FromString(File.ReadAllText("Config.atom"));

            var table = SqlGenerator.CreateTable(atom);

            var tablePath = Path.Combine(path, "Tables", string.Format("dbo.{0}.sql", atom.Name));

            File.WriteAllText(tablePath, table.TableSql);

            foreach (var item in SqlGenerator.MakeSprocs(atom, new List <AtomModel> {
                atom
            }))
            {
                var sprocs = Path.Combine(path, "Stored Procedures", string.Format("dbo.{0}.sql", item.Name));

                File.WriteAllText(sprocs, item.Sql);
            }

            foreach (var item in SqlGenerator.MakeCustomTables())
            {
                var sprocs = Path.Combine(path, "Types", "User-defined Data Types", string.Format("dbo.{0}Type.sql", item.Name));

                File.WriteAllText(sprocs, item.Sql);
            }
        }
Exemple #2
0
        public void UpdateSprocGenerators()
        {
            var atom = AtomCreator.FromString(File.ReadAllText("Config.atom"));

            var str = new UpdateSproc(atom).Generate();

            Console.WriteLine(str.Sql);
        }
Exemple #3
0
        public void RunTestAtom()
        {
            var atom = AtomCreator.FromString(File.ReadAllText("TestAtoms/test.atom"));
            var str  = SqlGenerator.CreateTable(atom);

            Console.WriteLine("=============");
            Console.WriteLine(atom.Name);
            Console.WriteLine("---");
            Console.WriteLine(str);
        }