Inheritance: ConfigurationElementCollection
 public static void InstantiateProviders(ProviderSettingsCollection configProviders, ProviderCollection providers, Type providerType)
 {
     foreach (ProviderSettings settings in configProviders)
     {
         providers.Add(InstantiateProvider(settings, providerType));
     }
 }
コード例 #2
0
        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));
        }
コード例 #3
0
        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);
        }
コード例 #4
0
        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));
        }
コード例 #5
0
 public static void InstantiateProviders(ProviderSettingsCollection providerSettings, ProviderCollection providers, Type type)
 {
     foreach (ProviderSettings settings in providerSettings)
     {
         providers.Add(ProvidersHelper.InstantiateProvider(settings, type));
     }
 }
コード例 #6
0
 internal static void InstantiateProviders(ProviderSettingsCollection configProviders, ContentManagementProviderCollection providers, Type providerType)
 {
     foreach (ProviderSettings settings in configProviders)
     {
         providers.Add(InstantiateProvider(settings, providerType));
     }
 }
コード例 #7
0
        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;
            }
        }
コード例 #8
0
ファイル: CacheSettings.cs プロジェクト: Kjubo/xms.core
		private static void InstantiateProviders(ProviderSettingsCollection configProviders, ProviderCollection providers, CacheSettings cacheSettings)
		{
			foreach (ProviderSettings settings in configProviders)
			{
				providers.Add(InstantiateProvider(settings, cacheSettings));
			}
		}
コード例 #9
0
        /// <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);
            }

        }