private static void GenerateFunctions() { string fileExt = FileExtension.DOT_CS; string[] functions = Db.Service.GetFunctionNameList(); string outDir = GetOutSubDir("Functions"); foreach (string tbl in functions) { string n = Regex.Split(tbl, @"\.")[1]; string className = Db.Service.GetSchema(n, TableType.Function).ClassName; Template tt = CodeService.BuildViewTemplate(n); tt.OutputPath = Path.Combine(outDir, className + fileExt); compiler.AddTemplate(tt); } }
private static void GenerateViews() { string fileExt = FileExtension.DOT_CS; //get the view list string[] views = Db.Service.GetViewNameList(); string outDir = GetOutSubDir("Views"); foreach (string tbl in views) { string className = Db.Service.GetSchema(tbl, TableType.View).ClassName; Template tt = CodeService.BuildViewTemplate(tbl); tt.OutputPath = Path.Combine(outDir, className + fileExt); compiler.AddTemplate(tt); } }
private static void GenerateTables() { string fileExt = FileExtension.DOT_CS; string[] tables = Db.Service.GetTableNameList(); string message = "Generating Table Entities for " + Db.Service.Name + " (" + tables.Length + " total)"; Console.WriteLine(message); string outDir = GetOutSubDir(); foreach (string tbl in tables) { string className = Db.Service.GetSchema(tbl, TableType.Table).ClassName; Template tt = CodeService.BuildClassTemplate(tbl); tt.OutputPath = Path.Combine(outDir, className + fileExt); compiler.AddTemplate(tt); } Console.WriteLine("Finished"); }
private static void GenerateContext() { string fileExt = FileExtension.DOT_CS; string outDir = GetOutputDirectory(); if (outDir == string.Empty) { outDir = Directory.GetCurrentDirectory(); } string outPath = Path.Combine(outDir, "Context" + fileExt); Console.WriteLine("Generating Structs to " + outPath); Template tt = CodeService.BuildContextTemplate(); tt.OutputPath = outPath; compiler.AddTemplate(tt); Console.WriteLine("Finished"); }