Add() public method

public Add ( ProviderSettings provider ) : void
provider ProviderSettings
return void
Exemplo n.º 1
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);
        }
        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));
        }
        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;
            }
        }