OutputChannelBinder.cs 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. //-----------------------------------------------------------------------------
  2. // Copyright (c) Microsoft Corporation. All rights reserved.
  3. //-----------------------------------------------------------------------------
  4. namespace System.ServiceModel.Dispatcher
  5. {
  6. using System;
  7. using System.Runtime;
  8. using System.ServiceModel;
  9. using System.ServiceModel.Channels;
  10. using System.ServiceModel.Diagnostics;
  11. class OutputChannelBinder : IChannelBinder
  12. {
  13. IOutputChannel channel;
  14. internal OutputChannelBinder(IOutputChannel channel)
  15. {
  16. if (channel == null)
  17. {
  18. Fx.Assert("OutputChannelBinder.OutputChannelBinder: (channel != null)");
  19. throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("channel");
  20. }
  21. this.channel = channel;
  22. }
  23. public IChannel Channel
  24. {
  25. get { return this.channel; }
  26. }
  27. public bool HasSession
  28. {
  29. get { return this.channel is ISessionChannel<IOutputSession>; }
  30. }
  31. public Uri ListenUri
  32. {
  33. get { return null; }
  34. }
  35. public EndpointAddress LocalAddress
  36. {
  37. get
  38. {
  39. #pragma warning suppress 56503 // [....], the property is really not implemented, cannot lie, API not public
  40. throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new NotImplementedException());
  41. }
  42. }
  43. public EndpointAddress RemoteAddress
  44. {
  45. get { return this.channel.RemoteAddress; }
  46. }
  47. public void Abort()
  48. {
  49. this.channel.Abort();
  50. }
  51. public void CloseAfterFault(TimeSpan timeout)
  52. {
  53. this.channel.Close(timeout);
  54. }
  55. public IAsyncResult BeginTryReceive(TimeSpan timeout, AsyncCallback callback, object state)
  56. {
  57. throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new NotImplementedException());
  58. }
  59. public bool EndTryReceive(IAsyncResult result, out RequestContext requestContext)
  60. {
  61. throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new NotImplementedException());
  62. }
  63. public RequestContext CreateRequestContext(Message message)
  64. {
  65. throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new NotImplementedException());
  66. }
  67. public IAsyncResult BeginSend(Message message, TimeSpan timeout, AsyncCallback callback, object state)
  68. {
  69. return this.channel.BeginSend(message, timeout, callback, state);
  70. }
  71. public void EndSend(IAsyncResult result)
  72. {
  73. this.channel.EndSend(result);
  74. }
  75. public void Send(Message message, TimeSpan timeout)
  76. {
  77. this.channel.Send(message, timeout);
  78. }
  79. public IAsyncResult BeginRequest(Message message, TimeSpan timeout, AsyncCallback callback, object state)
  80. {
  81. throw TraceUtility.ThrowHelperError(new NotImplementedException(), message);
  82. }
  83. public Message EndRequest(IAsyncResult result)
  84. {
  85. throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new NotImplementedException());
  86. }
  87. public bool TryReceive(TimeSpan timeout, out RequestContext requestContext)
  88. {
  89. throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new NotImplementedException());
  90. }
  91. public Message Request(Message message, TimeSpan timeout)
  92. {
  93. throw TraceUtility.ThrowHelperError(new NotImplementedException(), message);
  94. }
  95. public bool WaitForMessage(TimeSpan timeout)
  96. {
  97. throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new NotImplementedException());
  98. }
  99. public IAsyncResult BeginWaitForMessage(TimeSpan timeout, AsyncCallback callback, object state)
  100. {
  101. throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new NotImplementedException());
  102. }
  103. public bool EndWaitForMessage(IAsyncResult result)
  104. {
  105. throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new NotImplementedException());
  106. }
  107. }
  108. }