Exemplo n.º 1
0
        private static int Main(string[] args)
        {
            var app = new CommandLineApplication(throwOnUnexpectedArg: false)
            {
                Name = "dotnet ef"
            };

            new RootCommand().Configure(app);

            try
            {
                return(app.Execute(args));
            }
            catch (Exception ex)
            {
                if (ex is CommandException || ex is CommandParsingException)
                {
                    Reporter.WriteVerbose(ex.ToString());
                }
                else
                {
                    Reporter.WriteInformation(ex.ToString());
                }

                Reporter.WriteError(ex.Message);

                return(1);
            }
        }
Exemplo n.º 2
0
        private static int Main(string[] args)
        {
            var app = new CommandLineApplication()
            {
                Name = "ef"
            };

            new RootCommand().Configure(app);

            try
            {
                return(app.Execute(args));
            }
            catch (Exception ex)
            {
                var wrappedException = ex as WrappedException;
                if (ex is CommandException ||
                    ex is CommandParsingException ||
                    (wrappedException != null &&
                     wrappedException.Type == "Microsoft.EntityFrameworkCore.Design.OperationException"))
                {
                    Reporter.WriteVerbose(ex.ToString());
                }
                else
                {
                    Reporter.WriteInformation(ex.ToString());
                }

                Reporter.WriteError(ex.Message);

                return(1);
            }
        }