Пример #1
0
        static void Main(string[] args)
        {
            Options options = new Options();
            ParserResult <Options> result = Parser.Default.ParseArguments <Options>(args).WithParsed <Options>(o =>
            {
                if (string.IsNullOrEmpty(o.DataPackageFile))
                {
                    o.DataPackageFile = "ExtendedDataPackage.json";
                }
                options = o;
            });

            if (result.Tag == ParserResultType.NotParsed)
            {
                // Help text requested, or parsing failed. Exit.
                return;
            }

            DataPackage dataPackage = FilterJSON(options);

            if (options.ExportType == "gv")
            {
                ERD erd = new ERD(dataPackage.Tables);
                erd.Generate(options);
            }
            else if (options.ExportType == "json")
            {
                JSONSchema schema = new JSONSchema(dataPackage.Tables);
                schema.Generate(options);
            }
            else if (options.ExportType == "table")
            {
                JSONTable schema = new JSONTable(dataPackage.Tables);
                schema.Generate(options);
            }
            else if (options.ExportType == "csv")
            {
                CSVSchema schema = new CSVSchema(dataPackage.Tables);
                schema.Generate(options);
            }
            else if (options.ExportType == "sql")
            {
                SQL sql = new SQL(dataPackage.Tables);
                sql.Generate(options);
            }
            else if (options.ExportType == "html")
            {
                HTML html = new HTML(dataPackage);
                html.Generate(options);
            }
            else if (options.ExportType == "erd")
            {
                LucidChart lucidChart = new LucidChart(dataPackage);
                lucidChart.Generate(options);
            }
            else
            {
                Console.WriteLine("Export type not recognised");
            }
        }
Пример #2
0
        static void Main(string[] args)
        {
            Options options = new Options();
            ParserResult <Options> result = Parser.Default.ParseArguments <Options>(args).WithParsed <Options>(o =>
            {
                options = o;
            });

            if (result.Tag == ParserResultType.NotParsed)
            {
                // Help text requested, or parsing failed. Exit.
                return;
            }

            List <Table> tables = FilterJSON(options);

            if (options.ExportType == "gv")
            {
                ERD erd = new ERD(tables);
                erd.Generate(options);
            }
            else if (options.ExportType == "json")
            {
                JSONSchema schema = new JSONSchema(tables);
                schema.Generate(options);
            }
            else if (options.ExportType == "table")
            {
                JSONTable schema = new JSONTable(tables);
                schema.Generate(options);
            }
            else if (options.ExportType == "csv")
            {
                CSVSchema schema = new CSVSchema(tables);
                schema.Generate(options);
            }
            else if (options.ExportType == "sql")
            {
                SQL sql = new SQL(tables);
                sql.Generate(options);
            }
            else if (options.ExportType == "html")
            {
                HTML html = new HTML(tables);
                html.Generate(options);
            }
            else
            {
                Console.WriteLine("Export type not recognised");
            }
        }