Ejemplo n.º 1
0
        static void Main(string[] args)
        {
            #region Command-Line Arguments
            var argsParser = new Helpers.CommandLineArgsParser(args);
            if (argsParser["?"] != null || argsParser["help"] != null)
            {
                ShowUsage();
                Environment.Exit(0);
            }
            #endregion

            //string outputJsonSchema = Path.GetFullPath(Path.Combine(GetScriptFolder(), @".\AdventureWorksSchema.json"));
            var wizard = new ExtractWizard();
            if (argsParser["postgresql"] != null)
            {
                wizard.DbType = ExtractWizard.DbTypeEnum.PostgreSQL;
            }
            else if (argsParser["mssql"] != null)
            {
                wizard.DbType = ExtractWizard.DbTypeEnum.MSSQL;
            }
            wizard.OutputJsonSchema = argsParser["output"];
            wizard.ConnectionString = argsParser["cn"];


            wizard.Run();
        }
Ejemplo n.º 2
0
        static int HandleCommand(ParseResult parseResult, DbSchemaExtractorArgs cliArgs)
        {
            var previousColor = Console.ForegroundColor; Console.ForegroundColor = ConsoleColor.Green;

            Console.WriteLine($"Executing '{typeof(ExtractWizard).Name}' template...");
            Console.ForegroundColor = previousColor;

            var wizard = new ExtractWizard();

            wizard.DbType           = cliArgs.DbType;
            wizard.OutputJsonSchema = cliArgs.Output;
            wizard.ConnectionString = cliArgs.ConnectionString;

            wizard.Run(); // if mandatory args were not provided, will ask in Console

            previousColor = Console.ForegroundColor; Console.ForegroundColor = ConsoleColor.Green;
            Console.WriteLine($"Finished executing '{typeof(ExtractWizard).Name}' template.");
            Console.ForegroundColor = previousColor;

            return(0);
        }