SetDefaultProvider() public method

public SetDefaultProvider ( string sectionName, string providerName ) : void
sectionName string
providerName string
return void
Beispiel #1
0
        public virtual void Save(WebConfig wc)
        {
            if (OriginallyEnabled)
            {
                wc.RemoveProvider(sectionName, defaults.ProviderName, values.ProviderName);
            }

            if (!Enabled)
            {
                return;
            }

            // we need to save our connection strings even if we are using the default
            // provider definition
            wc.SaveConnectionString(defaults.ConnectionStringName, values.ConnectionStringName,
                                    values.ConnectionString);
            // we do this so our equality comparison that follows can work
            defaults.ConnectionString = values.ConnectionString;

            // we are enabled so we want to set our defaultProvider attribute
            wc.SetDefaultProvider(sectionName, values.ProviderName);

            if (defaults.Equals(values))
            {
                return;
            }

            // our defaults do not equal our new values so we need to redefine our provider
            XmlElement provider = wc.AddProvider(sectionName, defaults.ProviderName, values.ProviderName);

            SaveProvider(provider);
        }
Beispiel #2
0
        public virtual void Save(WebConfig wc)
        {
            if (OriginallyEnabled)
            {
                wc.RemoveProvider(sectionName, defaults.ProviderName, values.ProviderName);
            }

            if (!Enabled)
            {
                return;
            }

            // we need to save our connection strings even if we are using the default
            // provider definition
            wc.SaveConnectionString(defaults.ConnectionStringName, values.ConnectionStringName,
                                    values.ConnectionString);
            // we do this so our equality comparison that follows can work
            defaults.ConnectionString = values.ConnectionString;

            // we are enabled so we want to set our defaultProvider attribute
            wc.SetDefaultProvider(sectionName, values.ProviderName);

            //we need to skip this validation, because if the user enables a Provider and don't do any changes the tool will add just the provider section without adding the provider configuration
            //if (defaults.Equals(values)) return;

            // our defaults do not equal our new values so we need to redefine our provider
            XmlElement provider = wc.AddProvider(sectionName, defaults.ProviderName, values.ProviderName);

            SaveProvider(provider);
        }
        public virtual void Save(WebConfig wc)
        {
            if (OriginallyEnabled)
                wc.RemoveProvider(sectionName, defaults.ProviderName, values.ProviderName);

            if (!Enabled) return;

            // we need to save our connection strings even if we are using the default
            // provider definition
            wc.SaveConnectionString(defaults.ConnectionStringName, values.ConnectionStringName, 
                values.ConnectionString);
            // we do this so our equality comparison that follows can work
            defaults.ConnectionString = values.ConnectionString;

            // we are enabled so we want to set our defaultProvider attribute
            wc.SetDefaultProvider(sectionName, values.ProviderName);

            if (defaults.Equals(values)) return;

            // our defaults do not equal our new values so we need to redefine our provider
            XmlElement provider = wc.AddProvider(sectionName, defaults.ProviderName, values.ProviderName);

            SaveProvider(provider);
        }