InvokeServiceClient.cs 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. using Aitex.Core.Util;
  2. using Aitex.Core.WCF;
  3. namespace MECF.Framework.Common.OperationCenter
  4. {
  5. public class InvokeClient : Singleton<InvokeClient>
  6. {
  7. public bool InProcess { get; set; }
  8. private IInvokeService _service;
  9. public IInvokeService Service
  10. {
  11. get
  12. {
  13. if (_service == null)
  14. {
  15. if (InProcess)
  16. {
  17. _service = new InvokeService();
  18. }
  19. else
  20. {
  21. _service = new InvokeServiceClient();
  22. }
  23. }
  24. return _service;
  25. }
  26. }
  27. }
  28. public class InvokeServiceClient : ServiceClientWrapper<IInvokeService>, IInvokeService
  29. {
  30. public InvokeServiceClient()
  31. : base("Client_IInvokeService", "InvokeService")
  32. {
  33. }
  34. public void DoOperation(string operationName, params object[] args)
  35. {
  36. Invoke(svc => { svc.DoOperation(operationName, args); });
  37. }
  38. }
  39. }