DispatcherSynchronizationBehavior.cs 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. //------------------------------------------------------------
  2. // Copyright (c) Microsoft Corporation. All rights reserved.
  3. //------------------------------------------------------------
  4. namespace System.ServiceModel.Description
  5. {
  6. using System.ServiceModel;
  7. using System.ServiceModel.Dispatcher;
  8. using System.ServiceModel.Channels;
  9. public class DispatcherSynchronizationBehavior : IEndpointBehavior
  10. {
  11. public DispatcherSynchronizationBehavior() :
  12. this(false, MultipleReceiveBinder.MultipleReceiveDefaults.MaxPendingReceives)
  13. {
  14. }
  15. public DispatcherSynchronizationBehavior(bool asynchronousSendEnabled, int maxPendingReceives)
  16. {
  17. this.AsynchronousSendEnabled = asynchronousSendEnabled;
  18. this.MaxPendingReceives = maxPendingReceives;
  19. }
  20. public bool AsynchronousSendEnabled
  21. {
  22. get;
  23. set;
  24. }
  25. public int MaxPendingReceives
  26. {
  27. get;
  28. set;
  29. }
  30. void IEndpointBehavior.Validate(ServiceEndpoint serviceEndpoint)
  31. {
  32. }
  33. void IEndpointBehavior.AddBindingParameters(ServiceEndpoint serviceEndpoint, BindingParameterCollection parameters)
  34. {
  35. }
  36. void IEndpointBehavior.ApplyDispatchBehavior(ServiceEndpoint serviceEndpoint, EndpointDispatcher endpointDispatcher)
  37. {
  38. if (endpointDispatcher == null)
  39. {
  40. throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("endpointDispatcher");
  41. }
  42. endpointDispatcher.ChannelDispatcher.SendAsynchronously = this.AsynchronousSendEnabled;
  43. endpointDispatcher.ChannelDispatcher.MaxPendingReceives = this.MaxPendingReceives;
  44. }
  45. void IEndpointBehavior.ApplyClientBehavior(ServiceEndpoint serviceEndpoint, ClientRuntime behavior)
  46. {
  47. }
  48. }
  49. }