Ejemplo n.º 1
0
 private static void GenerateScripts(ConsoleParams prms)
 {
     ScriptFacade f = new ScriptFacade(prms.ConnectionString.Value, prms.DatabaseName.Value);
       GenScriptsPath = Path.Combine(ConfigurationManager.AppSettings["GenScriptPath"] ?? GenScriptsPath, prms.DatabaseName.Value);
       ScriptExtension = ConfigurationManager.AppSettings["ScriptExtension"] ?? ScriptExtension;
       CreateDirectioriesAsNeeded();
       System.Threading.Tasks.Parallel.ForEach(
     f.GetTableNames(prms.TablesPattern.Value)
     , tbl => GenerateTableScript(f, tbl));
 }
Ejemplo n.º 2
0
 private static void GenerateTableScript(ScriptFacade f, string tbl)
 {
     try
       {
     Console.WriteLine(string.Format("The table '{0}' gen started.", tbl));
     var script = f.GenerateTableDataScript(tbl);
     var file = string.Concat(Path.Combine(GenScriptsPath, tbl), ScriptExtension);
     File.WriteAllText(file, script);
     Console.WriteLine(string.Format("The table '{0}' gen finished.", tbl));
       }
       catch (Exception e)
       {
     Console.ForegroundColor = ConsoleColor.Red;
     Console.WriteLine(string.Format("The table '{0}' gen failed.", tbl));
     Console.ResetColor();
     Logger.Write(string.Concat(e.Message, Environment.NewLine, e.StackTrace));
       }
 }