public static void InstantiateProviders(ProviderSettingsCollection configProviders, ProviderCollection providers, Type providerType) { foreach (ProviderSettings settings in configProviders) { providers.Add(InstantiateProvider(settings, providerType)); } }
public static void InstantiateProviders(ProviderSettingsCollection configProviders, ProviderCollection providers, Type providerType) { if (!typeof(ProviderBase).IsAssignableFrom(providerType)) throw new ConfigurationErrorsException(String.Format("type '{0}' must subclass from ProviderBase", providerType)); foreach (ProviderSettings settings in configProviders) providers.Add(InstantiateProvider(settings, providerType)); }
private MembershipSection GetMembershipSection() { MembershipSection section = new MembershipSection(); section.DefaultProvider = "default"; ConfigurationProperty _propProviders = (ConfigurationProperty)typeof(MembershipSection).InvokeMember("_propProviders", System.Reflection.BindingFlags.Static | System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.GetField, null, typeof(MembershipSection), null); var collection = new System.Configuration.ProviderSettingsCollection(); collection.Add(new System.Configuration.ProviderSettings() { Name = "default", Type = "MvcApplication3.Custom.CustomMembershipProvider, MvcApplication3" }); // section[_propProviders] = collection; typeof(ConfigurationElement).InvokeMember("SetPropertyValue", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.InvokeMethod, null, section, new object[] { _propProviders, collection, false }); return(section); }
private static void EnsureProviders() { VerificationCodeSection verificationCodeSection = (VerificationCodeSection)WebConfigurationManager.GetSection(""); bool hasSection = verificationCodeSection != null; if (!hasSection) verificationCodeSection = new VerificationCodeSection(); persistenceMode = verificationCodeSection.PersistenceMode; InitializeTextProviders(hasSection, verificationCodeSection); InitialImageProviders(hasSection, verificationCodeSection); ProviderSettingsCollection pc = new ProviderSettingsCollection(); pc.Add(new ProviderSettings("filter", "ShepherdsFramework.Framework.Utilities.Captcha.CrosshatchVerificationCodeFilterProvider,ShepherdsFramework.Framework.Utilities.Captcha")); ProvidersHelper.InstantiateProviders(pc,FilterProviderCollection,typeof(VerificationCodeFilterProvider)); }
public static void InstantiateProviders(ProviderSettingsCollection providerSettings, ProviderCollection providers, Type type) { foreach (ProviderSettings settings in providerSettings) { providers.Add(ProvidersHelper.InstantiateProvider(settings, type)); } }
internal static void InstantiateProviders(ProviderSettingsCollection configProviders, ContentManagementProviderCollection providers, Type providerType) { foreach (ProviderSettings settings in configProviders) { providers.Add(InstantiateProvider(settings, providerType)); } }
private static void EnsureProviders() { if (!initialized) { VerificationCodeSection section = (VerificationCodeSection)WebConfigurationManager.GetSection("spbVerificationCode/autoInputProtection"); bool hasSection = section != null; if (!hasSection) section = new VerificationCodeSection(); //userMode = section.UserMode; PersistenceMode = section.PersistenceMode; InitializeTextProviders(hasSection, section); InitializeImageProviders(hasSection, section); ProviderSettingsCollection pc = new ProviderSettingsCollection(); pc.Add(new ProviderSettings("filters", "Spacebuilder.Common.CrosshatchVerificationCodeFilterProvider,Spacebuilder.Common")); ProvidersHelper.InstantiateProviders(pc, filterProviders, typeof(VerificationCodeFilterProvider)); initialized = true; } }
private static void InstantiateProviders(ProviderSettingsCollection configProviders, ProviderCollection providers, CacheSettings cacheSettings) { foreach (ProviderSettings settings in configProviders) { providers.Add(InstantiateProvider(settings, cacheSettings)); } }
/// <summary> /// Reads the configuration related to the set of configured /// providers and sets the default and collection of providers and settings. /// </summary> private static void Initialize() { MessageProviderConfiguration configSection = (MessageProviderConfiguration)ConfigurationManager.GetSection("MessageProviders"); if (configSection == null) throw new ConfigurationErrorsException("Data provider section is not set."); _providerCollection = new MessageProviderCollection(); ProvidersHelper.InstantiateProviders(configSection.Providers, _providerCollection, typeof(MessageProviderBase)); _providerSettings = configSection.Providers; if (_providerCollection.Count > 0) { if (_providerCollection[configSection.DefaultProviderName] == null) throw new ConfigurationErrorsException("Default data provider is not set."); _default = _providerCollection[configSection.DefaultProviderName]; var defaultSettings = _providerSettings[configSection.DefaultProviderName]; _default.SetParameters(defaultSettings.Parameters); } }