PolicyImporterElement.cs 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  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.ServiceModel.Description;
  9. public sealed partial class PolicyImporterElement : ConfigurationElement
  10. {
  11. public PolicyImporterElement()
  12. {
  13. }
  14. public PolicyImporterElement(string type)
  15. {
  16. this.Type = type;
  17. }
  18. public PolicyImporterElement(Type type)
  19. {
  20. SubclassTypeValidator validator = new SubclassTypeValidator(typeof(IPolicyImportExtension));
  21. validator.Validate(type);
  22. this.Type = type.AssemblyQualifiedName;
  23. }
  24. [ConfigurationProperty(ConfigurationStrings.Type, Options = ConfigurationPropertyOptions.IsRequired | ConfigurationPropertyOptions.IsKey)]
  25. [StringValidator(MinLength = 1)]
  26. public string Type
  27. {
  28. get
  29. { return (string)base[ConfigurationStrings.Type]; }
  30. set
  31. {
  32. if (String.IsNullOrEmpty(value))
  33. {
  34. value = String.Empty;
  35. }
  36. base[ConfigurationStrings.Type] = value;
  37. }
  38. }
  39. }
  40. }