SaveConnectionString() публичный Метод

public SaveConnectionString ( string defaultName, string name, string connectionString ) : void
defaultName string
name string
connectionString string
Результат void
Пример #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);
        }
Пример #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);
        }
Пример #3
0
        public override void Save(WebConfig wc)
        {
            if (!_membershipEnabled)
            {
                return;
            }

            if (OriginallyEnabled)
            {
                XmlElement e = wc.GetProviderSection(sectionName);
                e.ParentNode.RemoveChild(e);
            }

            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);

            defaults.ConnectionString = values.ConnectionString;

            XmlElement provider = wc.AddProvider(sectionName, defaults.ProviderName, values.ProviderName);

            var webPartsNode    = wc.GetSystemWebNode(sectionName, true, false) as XmlElement;
            var personalization = webPartsNode.FirstChild as XmlElement;

            personalization.SetAttribute("defaultProvider", defaults.ProviderName);

            SaveProvider(provider);
        }
Пример #4
0
        public override void Save(WebConfig wc)
        {
            if (OriginallyEnabled)
            {
                XmlElement e = wc.GetProviderSection(sectionName);
                e.ParentNode.RemoveChild(e);
            }

            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;

            XmlElement provider = wc.AddProvider(sectionName, null, values.ProviderName);

            SaveProvider(provider);

            // we are enabled so we want to set our defaultProvider attribute
            XmlElement sessionNode = (XmlElement)provider.ParentNode.ParentNode;

            sessionNode.SetAttribute("mode", "Custom");
            sessionNode.SetAttribute("cookieless", "true");
            sessionNode.SetAttribute("regenerateExpiredSessionId", "true");
            sessionNode.SetAttribute("customProvider", values.ProviderName);
        }
Пример #5
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);
        }
        public override void Save(WebConfig wc)
        {
            if (OriginallyEnabled)
            {
                XmlElement e = wc.GetProviderSection(sectionName);
                e.ParentNode.RemoveChild(e);
            }

            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;

            XmlElement provider = wc.AddProvider(sectionName, null, values.ProviderName);
            SaveProvider(provider);

            // we are enabled so we want to set our defaultProvider attribute
            XmlElement sessionNode = (XmlElement)provider.ParentNode.ParentNode;
            sessionNode.SetAttribute("mode", "Custom");
            sessionNode.SetAttribute("cookieless", "true");
            sessionNode.SetAttribute("regenerateExpiredSessionId", "true");
            sessionNode.SetAttribute("customProvider", values.ProviderName);
        }