SomebodyClient.cs 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. using Aitex.Core.Util;
  2. using Aitex.Core.WCF;
  3. using MECF.Framework.Common.Equipment;
  4. using MECF.Framework.Common.RecipeCenter;
  5. using System;
  6. using System.Collections.Generic;
  7. using System.Diagnostics;
  8. using System.Linq;
  9. using System.Text;
  10. using System.Threading.Tasks;
  11. namespace Common.WcfService
  12. {
  13. public class SomebodyClient : Singleton<SomebodyClient>
  14. {
  15. public bool InProcess { get; set; }
  16. private IService _service;
  17. public IService Service
  18. { get
  19. {
  20. if (_service == null)
  21. {
  22. if (InProcess)
  23. _service = new SomebodyService();
  24. else
  25. _service = new SomebodyServiceClient();
  26. }
  27. return _service;
  28. } }
  29. }
  30. public class SomebodyServiceClient : ServiceClientWrapper<IService>, IService
  31. {
  32. public SomebodyServiceClient()
  33. : base("Client_IService", "SomeBodyService")
  34. {
  35. Trace.WriteLine("SomebodyServiceClient 初始化");
  36. }
  37. public string GetSomebodyName(ModuleName module, string SomebodyName)
  38. {
  39. string result = null;
  40. Invoke(svc => { result = svc.GetSomebodyName(module, SomebodyName); });
  41. return result;
  42. }
  43. }
  44. }