DispatcherSynchronizationElement.cs 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. //------------------------------------------------------------------------------
  2. // Copyright (c) Microsoft Corporation. All rights reserved.
  3. //------------------------------------------------------------------------------
  4. namespace System.ServiceModel.Configuration
  5. {
  6. using System.Configuration;
  7. using System.ServiceModel.Description;
  8. using System.ServiceModel.Dispatcher;
  9. using System.Diagnostics.CodeAnalysis;
  10. using System.Runtime;
  11. public sealed partial class DispatcherSynchronizationElement : BehaviorExtensionElement
  12. {
  13. public DispatcherSynchronizationElement()
  14. {
  15. }
  16. [ConfigurationProperty(ConfigurationStrings.AsynchronousSendEnabled, DefaultValue = false)]
  17. public bool AsynchronousSendEnabled
  18. {
  19. get { return (bool)base[ConfigurationStrings.AsynchronousSendEnabled]; }
  20. set { base[ConfigurationStrings.AsynchronousSendEnabled] = value; }
  21. }
  22. [ConfigurationProperty(ConfigurationStrings.MaxPendingReceives,
  23. DefaultValue = MultipleReceiveBinder.MultipleReceiveDefaults.MaxPendingReceives)]
  24. [IntegerValidator(MinValue = 1)]
  25. public int MaxPendingReceives
  26. {
  27. get { return (int)base[ConfigurationStrings.MaxPendingReceives]; }
  28. set { base[ConfigurationStrings.MaxPendingReceives] = value; }
  29. }
  30. public override Type BehaviorType
  31. {
  32. get { return typeof(DispatcherSynchronizationBehavior); }
  33. }
  34. public override void CopyFrom(ServiceModelExtensionElement from)
  35. {
  36. base.CopyFrom(from);
  37. DispatcherSynchronizationElement source = (DispatcherSynchronizationElement)from;
  38. this.AsynchronousSendEnabled = source.AsynchronousSendEnabled;
  39. this.MaxPendingReceives = source.MaxPendingReceives;
  40. }
  41. protected internal override object CreateBehavior()
  42. {
  43. return new DispatcherSynchronizationBehavior(this.AsynchronousSendEnabled, this.MaxPendingReceives);
  44. }
  45. }
  46. }