ServiceModelTimeSpanValidator.cs 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. //-----------------------------------------------------------------------------
  2. // Copyright (c) Microsoft Corporation. All rights reserved.
  3. //-----------------------------------------------------------------------------
  4. namespace System.ServiceModel.Configuration
  5. {
  6. using System;
  7. using System.Configuration;
  8. using System.Runtime;
  9. // deals with
  10. [AttributeUsage(AttributeTargets.Property)]
  11. sealed class ServiceModelTimeSpanValidatorAttribute : ConfigurationValidatorAttribute
  12. {
  13. TimeSpanValidatorAttribute innerValidatorAttribute;
  14. public ServiceModelTimeSpanValidatorAttribute()
  15. {
  16. this.innerValidatorAttribute = new TimeSpanValidatorAttribute();
  17. this.innerValidatorAttribute.MaxValueString = TimeoutHelper.MaxWait.ToString();
  18. }
  19. public override ConfigurationValidatorBase ValidatorInstance
  20. {
  21. get
  22. {
  23. return new TimeSpanOrInfiniteValidator(MinValue, MaxValue);
  24. }
  25. }
  26. public TimeSpan MinValue
  27. {
  28. get
  29. {
  30. return this.innerValidatorAttribute.MinValue;
  31. }
  32. }
  33. public string MinValueString
  34. {
  35. get
  36. {
  37. return this.innerValidatorAttribute.MinValueString;
  38. }
  39. set
  40. {
  41. this.innerValidatorAttribute.MinValueString = value;
  42. }
  43. }
  44. public TimeSpan MaxValue
  45. {
  46. get
  47. {
  48. return this.innerValidatorAttribute.MaxValue;
  49. }
  50. }
  51. public string MaxValueString
  52. {
  53. get
  54. {
  55. return this.innerValidatorAttribute.MaxValueString;
  56. }
  57. set
  58. {
  59. this.innerValidatorAttribute.MaxValueString = value;
  60. }
  61. }
  62. }
  63. }