private static IEnumerable<ConfigurationSectionManageabilityProviderData> GetConfigurationManageabilityProviders( ConfigurationManageabilityProviderAttributeRetriever retriever) { foreach (var sectionAttribute in retriever.SectionManageabilityProviderAttributes) { var sectionProviderElement = new ConfigurationSectionManageabilityProviderData( sectionAttribute.SectionName, sectionAttribute.ManageabilityProviderType); foreach (var elementAttribute in retriever.ElementManageabilityProviderAttributes) { if (elementAttribute.SectionManageabilityProviderType == sectionAttribute.ManageabilityProviderType) { sectionProviderElement.ManageabilityProviders.Add( new ConfigurationElementManageabilityProviderData( elementAttribute.TargetType.Name, elementAttribute.ManageabilityProviderType, elementAttribute.TargetType)); } } yield return sectionProviderElement; } }
public ConfigurationSectionManageabilityProvider CreateConfigurationSectionManageabilityProvider( ConfigurationSectionManageabilityProviderData manageabilityProviderData) { IDictionary <Type, ConfigurationElementManageabilityProvider> subProviders = new Dictionary <Type, ConfigurationElementManageabilityProvider>(); foreach (ConfigurationElementManageabilityProviderData subProviderData in manageabilityProviderData.ManageabilityProviders) { ConfigurationElementManageabilityProvider subManageabilityProvider = CreateConfigurationElementManageabilityProvider(subProviderData); subProviders.Add(subProviderData.TargetType, subManageabilityProvider); } return((ConfigurationSectionManageabilityProvider)Activator.CreateInstance(manageabilityProviderData.Type, subProviders)); }
/// <summary> /// Create a manageability configuration provider. /// </summary> /// <param name="manageabilityProviderData">The provdier data.</param> /// <returns>A <see cref="ConfigurationSectionManageabilityProvider"/> object.</returns> public ConfigurationSectionManageabilityProvider CreateConfigurationSectionManageabilityProvider( ConfigurationSectionManageabilityProviderData manageabilityProviderData) { if (manageabilityProviderData == null) throw new ArgumentNullException("manageabilityProviderData"); IDictionary<Type, ConfigurationElementManageabilityProvider> subProviders = new Dictionary<Type, ConfigurationElementManageabilityProvider>(); foreach (ConfigurationElementManageabilityProviderData subProviderData in manageabilityProviderData.ManageabilityProviders) { ConfigurationElementManageabilityProvider subManageabilityProvider = CreateConfigurationElementManageabilityProvider(subProviderData); subProviders.Add(subProviderData.TargetType, subManageabilityProvider); } return (ConfigurationSectionManageabilityProvider)Activator.CreateInstance(manageabilityProviderData.Type, subProviders); }