Program.cs 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. using Sers.SersLoader;
  2. using Sers.ServiceStation;
  3. using System.Collections.Concurrent;
  4. namespace Did.SersLoader.Demo
  5. {
  6. public class Program
  7. {
  8. public static void Main(string[] args)
  9. {
  10. BlockingCollection<object> queue=new BlockingCollection<object>(10);
  11. //queue.BoundedCapacity
  12. try
  13. {
  14. for(var t=0;t<10;t++)
  15. queue.Add(new object());
  16. var td = queue.TryAdd(new object());
  17. queue.Add(new object());
  18. }
  19. catch (System.Exception ex)
  20. {
  21. throw;
  22. }
  23. //ServiceStation.AutoRun();
  24. ////手动指定Station版本号
  25. //Sers.Core.Module.App.SersApplication.serviceStationInfo.stationVersion = "2.1.1";
  26. //(x.1) Init
  27. ServiceStation.Init();
  28. #region (x.2)加载api
  29. //ServiceStation.Instance.LoadSersApi(typeof(Program).Assembly);
  30. ServiceStation.Instance.LoadSersApi(typeof(Program).Assembly, new ApiLoaderConfig { apiStationName = "demo" });
  31. ServiceStation.Instance.LoadApi();
  32. #endregion
  33. //(x.3) Start
  34. ServiceStation.Start();
  35. //(x.4) RunAwait
  36. ServiceStation.RunAwait();
  37. }
  38. }
  39. }