示例#1
0
        static void InitializeConfig()
        {
            wcfServices = (WcfServiceConfigurationSection)ConfigurationManager.GetSection("wcfServices");
            foreach (WcfServiceConfigElement item in wcfServices.Services)
            {
                Type hostType     = Type.GetType(item.HostTypeDeclaration);
                Type contractType = Type.GetType(item.ContractTypeDeclaration);
                var  configItem   = new ServiceConfig {
                    Item = item, HostType = hostType, ContractType = contractType
                };

                if (hostType != null && !wcfServiceConfigByType.ContainsKey(hostType))
                {
                    wcfServiceConfigByType.Add(hostType, configItem);
                }

                if (contractType != null && !wcfServiceConfigByType.ContainsKey(contractType))
                {
                    wcfServiceConfigByType.Add(contractType, configItem);
                }

                if (!wcfServiceConfigByKey.ContainsKey(item.Key))
                {
                    wcfServiceConfigByKey.Add(item.Key, configItem);
                }
            }
        }
示例#2
0
		static void InitializeConfig()
		{
			wcfServices = (WcfServiceConfigurationSection)ConfigurationManager.GetSection("wcfServices");
			foreach (WcfServiceConfigElement item in wcfServices.Services)
			{
				Type hostType = Type.GetType(item.HostTypeDeclaration);
				Type contractType = Type.GetType(item.ContractTypeDeclaration);
				var configItem = new ServiceConfig { Item = item, HostType = hostType, ContractType = contractType };
				
				if (hostType != null && !wcfServiceConfigByType.ContainsKey(hostType))
					wcfServiceConfigByType.Add(hostType, configItem);

				if (contractType != null && !wcfServiceConfigByType.ContainsKey(contractType))
					wcfServiceConfigByType.Add(contractType, configItem);

				if (!wcfServiceConfigByKey.ContainsKey(item.Key))
					wcfServiceConfigByKey.Add(item.Key, configItem);
			}
		}