Program.cs 2.7 KB

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