Program.cs 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. // See https://aka.ms/new-console-template for more information
  2. using System.Reflection;
  3. using Quadarax.Foundation.Core.Console;
  4. using Quadarax.Foundation.Core.QConsole;
  5. using Quadarax.Foundation.Core.QConsole.Configuration;
  6. using Quadarax.Foundation.Core.QConsole.Context;
  7. using Quadarax.Foundation.Core.Reflection.Extensions;
  8. /*
  9. var options = new DbContextOptions<QlbrcDbContext>();
  10. using (var ctx = new QlbrcDbContext(options))
  11. {
  12. var result = ctx.Database.EnsureCreated();
  13. Console.WriteLine($"Database created: {result}");
  14. }
  15. */
  16. var config = new StartupConfiguration(Quadarax.Application.QLiberace.Console.Constants.General.Name, Assembly.GetExecutingAssembly().GetName().Version);
  17. config.ConsoleCopyright = Assembly.GetExecutingAssembly().GetCopyright();
  18. config.AllowInteractive = false;
  19. config.WaitOnKeyInNonInteractiveMode = false;
  20. config.CommandDefinitionAssebmly = new[]{Assembly.GetEntryAssembly()};
  21. config.DisableDefaultCommands();
  22. config.ShowStatusOnEveryCommand = false;
  23. config.IsConsoleDebug = false;
  24. var console = new Engine(config, new DefualtEngineContext(), args);
  25. console.Start();
  26. using (var writer = new ConsoleWriter(console.ReturnCode == 0 ? ConsoleColor.DarkGreen : console.ReturnCode < 9 ? ConsoleColor.DarkYellow : ConsoleColor.DarkRed))
  27. writer.WriteLine($"Exiting with return code {console.ReturnCode}");
  28. Environment.Exit(console.ReturnCode);