public static List <SupportedType> LoadSupportedTypes() { MessageBusSection busSection = (MessageBusSection)ConfigurationManager.GetSection(ConfigLabels.MESSAGE_BUS_SECTION); SupportedMessageTypeCollection collection = busSection.SupportedMessages; IEnumerator enumerator = collection.GetEnumerator(); List <SupportedType> result = new List <SupportedType>(); while (enumerator.MoveNext()) { SupportedType current = enumerator.Current as SupportedType; result.Add(current); } return(result); }
public static int GetIntParameter(String type, string parameterName, int defaultValue = 0) { SupportedType supportedType = LoadSupportedTypes().Where(x => x.Value == type).SingleOrDefault(); if (supportedType.IsNotNull() && supportedType.Params.IsNotNull()) { IEnumerator paramsEnumerator = supportedType.Params.GetEnumerator(); while (paramsEnumerator.MoveNext()) { Parameter parameter = paramsEnumerator.Current as Parameter; if (parameter.Name.Equals(parameterName)) { return(ConvertParamToInt(parameter, defaultValue)); } } } return(GetIntParameter(parameterName, defaultValue)); }
protected override object GetElementKey(ConfigurationElement element) { SupportedType supportedType = element as SupportedType; return(supportedType.Value); }