/******************************************************************************* * Copyright(c) 2014 DongkeSoft All rights reserved. / Confidential * 类的信息: * 1.程序名称:BatchingHostingSettings.cs * 2.功能描述:配置文件信息 * 编辑履历: * 作者 日期 版本 修改内容 * 陈晓野 2014/09/16 1.00 新建 *******************************************************************************/ using System; using System.ComponentModel; using System.Configuration; namespace Dongke.IBOSS.PRD.WCF.Services.ConfigSetting { /// /// 表示配置文件中的节 /// public class BatchingHostingSettings : ConfigurationSection { [ConfigurationProperty("", IsDefaultCollection = true)] public ServiceTypeElementCollection ServiceTypes { get { return (ServiceTypeElementCollection)this[""]; } } public static BatchingHostingSettings GetSection() { return ConfigurationManager.GetSection("dongke.batchingHosting") as BatchingHostingSettings; } } /// /// 表示包含一个子元素集合的配置元素 /// public class ServiceTypeElementCollection : ConfigurationElementCollection { protected override ConfigurationElement CreateNewElement() { return new ServiceTypeElement(); } protected override object GetElementKey(ConfigurationElement element) { ServiceTypeElement serviceTypeElement = (ServiceTypeElement)element; return serviceTypeElement.ServiceType.MetadataToken; } } /// /// 表示配置文件中的配置元素 /// public class ServiceTypeElement : ConfigurationElement { [ConfigurationProperty("type", IsRequired = true)] [TypeConverter(typeof(AssemblyQualifiedTypeNameConverter))] public Type ServiceType { get { return (Type)this["type"]; } set { this["type"] = value; } } } }