Program.cs 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. using System.IO.Abstractions;
  2. using System.Reflection;
  3. using BO.AppServer.Metadata.Dto;
  4. using Quadarax.Foundation.Core.Data.Interface.Entity.Dto;
  5. using Quadarax.Foundation.Core.Json;
  6. using Quadarax.Foundation.Core.QConsole;
  7. using Quadarax.Foundation.Core.QConsole.Configuration;
  8. using Quadarax.Foundation.Core.QConsole.Context;
  9. using Quadarax.Foundation.Core.Reflection.Extensions;
  10. using Binder = Quadarax.Foundation.Core.Json.Binder;
  11. namespace BO.Console
  12. {
  13. class Program
  14. {
  15. static void Main(string[] args)
  16. {
  17. /*
  18. var user = new UserCDto()
  19. {
  20. Name = "foo",
  21. Email = "fii",
  22. LangLcid = 123,
  23. Password = "frr",
  24. Roles = new[] { "So", "Fa" }
  25. };
  26. var _binder = new Binder(new FileSystem());
  27. _binder.SerializerOptions.IgnoreReadOnlyProperties = true;
  28. _binder.SerializerOptions.IgnoreNullValues = true;
  29. var res = _binder.SaveToString(user);
  30. */
  31. /*
  32. var content = "{\"value\":null,\"isSuccess\":false,\"errors\":[{\"message\":\"User 'Console' has no permission to login in. Access denied!\",\"code\":1200}]}";
  33. //var content = "{\"isSuccess\":false,\"values\":[{\"message\":\"User 'Console' has no permission to login in. Access denied!\",\"code\":1200}]}";
  34. var _binder = new Binder(new FileSystem());
  35. _binder.SerializerOptions.IgnoreReadOnlyProperties = true;
  36. _binder.SerializerOptions.IgnoreNullValues = true;
  37. var res = _binder.LoadFromString(content, typeof(ResultValueDto<UserRDto>));
  38. */
  39. /*
  40. var dto = new ResultValueDto<AuthDto>();
  41. dto.Value.Ticket = "foo";
  42. var bnd = new Binder(new FileSystem());
  43. //bnd.SerializerOptions.IgnoreReadOnlyProperties = true;
  44. var str = bnd.SaveToString(dto);
  45. var dto2 = bnd.LoadFromString(str, typeof(ResultValueDto<AuthDto>));
  46. //var dto2 = new ResultValueDto<AuthDto>();
  47. //bnd.LoadFromStringTo(str, dto2, typeof(ResultValueDto<AuthDto>));
  48. */
  49. var config = new StartupConfiguration("BO Console", Assembly.GetExecutingAssembly().GetName().Version);
  50. config.ConsoleCopyright = Assembly.GetExecutingAssembly().GetCopyright();
  51. config.AllowInteractive = false;
  52. config.WaitOnKeyInNonInteractiveMode = false;
  53. config.CommandDefinitionAssebmly = new Assembly[]{Assembly.GetEntryAssembly()};
  54. config.DisableDefaultCommands();
  55. config.ShowStatusOnEveryCommand = false;
  56. config.IsConsoleDebug = false;
  57. var console = new Engine(config, new DefualtEngineContext(), args);
  58. console.Start();
  59. }
  60. }
  61. }