BatchingHostingSettings.cs 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. /*******************************************************************************
  2. * Copyright(c) 2014 DongkeSoft All rights reserved. / Confidential
  3. * 类的信息:
  4. * 1.程序名称:BatchingHostingSettings.cs
  5. * 2.功能描述:配置文件信息
  6. * 编辑履历:
  7. * 作者 日期 版本 修改内容
  8. * 陈晓野 2014/09/16 1.00 新建
  9. *******************************************************************************/
  10. using System;
  11. using System.ComponentModel;
  12. using System.Configuration;
  13. namespace Dongke.IBOSS.PRD.WCF.Services.ConfigSetting
  14. {
  15. /// <summary>
  16. /// 表示配置文件中的节
  17. /// </summary>
  18. public class BatchingHostingSettings : ConfigurationSection
  19. {
  20. [ConfigurationProperty("", IsDefaultCollection = true)]
  21. public ServiceTypeElementCollection ServiceTypes
  22. {
  23. get
  24. {
  25. return (ServiceTypeElementCollection)this[""];
  26. }
  27. }
  28. public static BatchingHostingSettings GetSection()
  29. {
  30. return ConfigurationManager.GetSection("dongke.batchingHosting") as BatchingHostingSettings;
  31. }
  32. }
  33. /// <summary>
  34. /// 表示包含一个子元素集合的配置元素
  35. /// </summary>
  36. public class ServiceTypeElementCollection : ConfigurationElementCollection
  37. {
  38. protected override ConfigurationElement CreateNewElement()
  39. {
  40. return new ServiceTypeElement();
  41. }
  42. protected override object GetElementKey(ConfigurationElement element)
  43. {
  44. ServiceTypeElement serviceTypeElement = (ServiceTypeElement)element;
  45. return serviceTypeElement.ServiceType.MetadataToken;
  46. }
  47. }
  48. /// <summary>
  49. /// 表示配置文件中的配置元素
  50. /// </summary>
  51. public class ServiceTypeElement : ConfigurationElement
  52. {
  53. [ConfigurationProperty("type", IsRequired = true)]
  54. [TypeConverter(typeof(AssemblyQualifiedTypeNameConverter))]
  55. public Type ServiceType
  56. {
  57. get
  58. {
  59. return (Type)this["type"];
  60. }
  61. set
  62. {
  63. this["type"] = value;
  64. }
  65. }
  66. }
  67. }