ClientUriBehavior.cs 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. //-----------------------------------------------------------------------------
  2. // Copyright (c) Microsoft Corporation. All rights reserved.
  3. //-----------------------------------------------------------------------------
  4. namespace System.ServiceModel.Description
  5. {
  6. using System;
  7. using System.ServiceModel.Channels;
  8. using System.ServiceModel.Dispatcher;
  9. using System.Collections.Generic;
  10. public class ClientViaBehavior : IEndpointBehavior
  11. {
  12. Uri uri;
  13. public ClientViaBehavior(Uri uri)
  14. {
  15. if (uri == null)
  16. throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("uri");
  17. this.uri = uri;
  18. }
  19. public Uri Uri
  20. {
  21. get { return this.uri; }
  22. set
  23. {
  24. if (value == null)
  25. throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("value");
  26. this.uri = value;
  27. }
  28. }
  29. void IEndpointBehavior.Validate(ServiceEndpoint serviceEndpoint)
  30. {
  31. }
  32. void IEndpointBehavior.AddBindingParameters(ServiceEndpoint serviceEndpoint, BindingParameterCollection bindingParameters)
  33. {
  34. }
  35. void IEndpointBehavior.ApplyDispatchBehavior(ServiceEndpoint serviceEndpoint, EndpointDispatcher endpointDispatcher)
  36. {
  37. throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(
  38. SR.GetString(SR.SFXEndpointBehaviorUsedOnWrongSide, typeof(ClientViaBehavior).Name)));
  39. }
  40. void IEndpointBehavior.ApplyClientBehavior(ServiceEndpoint serviceEndpoint, ClientRuntime behavior)
  41. {
  42. if (behavior == null)
  43. {
  44. throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("behavior");
  45. }
  46. behavior.Via = this.Uri;
  47. }
  48. }
  49. }