GetConnectionString() 공개 메소드

public GetConnectionString ( string name ) : string
name string
리턴 string
예제 #1
0
        public override void Initialize(WebConfig wc)
        {
            GetDefaults();
            values = defaults;

            // get the default provider
            XmlElement e = wc.GetProviderSection(sectionName);

            if (e != null)
            {
                string mode = e.GetAttribute("mode");
                if (String.Compare(mode, "custom", true) == 0)
                {
                    DefaultProvider = e.GetAttribute("customProvider");
                }
            }

            e = wc.GetProviderElement(sectionName);
            if (e != null)
            {
                values.ProviderName = e.GetAttribute("name");
                if (e.HasAttribute("connectionStringName"))
                {
                    values.ConnectionStringName = e.GetAttribute("connectionStringName");
                }
                if (e.HasAttribute("description"))
                {
                    values.AppDescription = e.GetAttribute("description");
                }
                if (e.HasAttribute("applicationName"))
                {
                    values.AppName = e.GetAttribute("applicationName");
                }
                if (e.HasAttribute("writeExceptionsToEventLog"))
                {
                    values.WriteExceptionToLog = GetBoolValue(e.GetAttribute("writeExceptionsToEventLog"), false);
                }
                if (e.HasAttribute("autogenerateschema"))
                {
                    values.AutoGenSchema = GetBoolValue(e.GetAttribute("autogenerateschema"), false);
                }
                if (e.HasAttribute("enableExpireCallback"))
                {
                    values.EnableExpireCallback = GetBoolValue(e.GetAttribute("enableExpireCallback"), false);
                }
            }
            values.ConnectionString = wc.GetConnectionString(values.ConnectionStringName);
            Enabled = OriginallyEnabled = DefaultProvider != null &&
                                          (DefaultProvider == values.ProviderName ||
                                           DefaultProvider == defaults.ProviderName);
        }
예제 #2
0
        public virtual void Initialize(WebConfig wc)
        {
            // first load up the defaults
            GetDefaults();
            values = defaults;

            // get the default provider
            XmlElement e = wc.GetProviderSection(sectionName);

            if (e != null)
            {
                DefaultProvider = e.GetAttribute("defaultProvider");
            }

            e = wc.GetProviderElement(sectionName);
            if (e != null)
            {
                values.ProviderName = e.GetAttribute("name");
                if (e.HasAttribute("connectionStringName"))
                {
                    values.ConnectionStringName = e.GetAttribute("connectionStringName");
                }
                if (e.HasAttribute("description"))
                {
                    values.AppDescription = e.GetAttribute("description");
                }
                if (e.HasAttribute("applicationName"))
                {
                    values.AppName = e.GetAttribute("applicationName");
                }
                if (e.HasAttribute("writeExceptionsToEventLog"))
                {
                    values.WriteExceptionToLog = GetBoolValue(e.GetAttribute("writeExceptionsToEventLog"), false);
                }
                if (e.HasAttribute("autogenerateschema"))
                {
                    values.AutoGenSchema = GetBoolValue(e.GetAttribute("autogenerateschema"), false);
                }
            }
            values.ConnectionString = wc.GetConnectionString(values.ConnectionStringName);
            Enabled = OriginallyEnabled = DefaultProvider != null &&
                                          (DefaultProvider == values.ProviderName ||
                                           DefaultProvider == defaults.ProviderName);
        }
예제 #3
0
        public virtual void Initialize(WebConfig wc)
        {
            // first load up the defaults
            GetDefaults();
            values = defaults;

            // get the default provider
            XmlElement e = wc.GetProviderSection(sectionName);
            if (e != null)
                DefaultProvider = e.GetAttribute("defaultProvider");

            e = wc.GetProviderElement(sectionName);
            if (e != null)
            {
                values.ProviderName = e.GetAttribute("name");
                if (e.HasAttribute("connectionStringName"))
                    values.ConnectionStringName = e.GetAttribute("connectionStringName");
                if (e.HasAttribute("description"))
                    values.AppDescription = e.GetAttribute("description");
                if (e.HasAttribute("applicationName"))
                    values.AppName = e.GetAttribute("applicationName");
                if (e.HasAttribute("writeExceptionsToEventLog"))
                    values.WriteExceptionToLog = GetBoolValue(e.GetAttribute("writeExceptionsToEventLog"), false);
                if (e.HasAttribute("autogenerateschema"))
                    values.AutoGenSchema = GetBoolValue(e.GetAttribute("autogenerateschema"), false);
            }
            values.ConnectionString = wc.GetConnectionString(values.ConnectionStringName);
            Enabled = OriginallyEnabled = DefaultProvider != null && 
                (DefaultProvider == values.ProviderName ||
                DefaultProvider == defaults.ProviderName);
        }
        public override void Initialize(WebConfig wc)
        {
            GetDefaults();
            values = defaults;

            // get the default provider
            XmlElement e = wc.GetProviderSection(sectionName);
            if (e != null)
            {
                string mode = e.GetAttribute("mode");
                if (String.Compare(mode, "custom", true) == 0)
                    DefaultProvider = e.GetAttribute("customProvider");
            }

            e = wc.GetProviderElement(sectionName);
            if (e != null)
            {
                values.ProviderName = e.GetAttribute("name");
                if (e.HasAttribute("connectionStringName"))
                    values.ConnectionStringName = e.GetAttribute("connectionStringName");
                if (e.HasAttribute("description"))
                    values.AppDescription = e.GetAttribute("description");
                if (e.HasAttribute("applicationName"))
                    values.AppName = e.GetAttribute("applicationName");
                if (e.HasAttribute("writeExceptionsToEventLog"))
                    values.WriteExceptionToLog = GetBoolValue(e.GetAttribute("writeExceptionsToEventLog"), false);
                if (e.HasAttribute("autogenerateschema"))
                    values.AutoGenSchema = GetBoolValue(e.GetAttribute("autogenerateschema"), false);
            }
            values.ConnectionString = wc.GetConnectionString(values.ConnectionStringName);
            Enabled = OriginallyEnabled = DefaultProvider != null && 
                (DefaultProvider == values.ProviderName ||
                DefaultProvider == defaults.ProviderName);
        }
예제 #5
0
        public virtual void Initialize(WebConfig wc)
        {
            // first load up the defaults
            GetDefaults();
            values = defaults;
            if (string.IsNullOrEmpty(values.ProviderName))
            {
                NotInstalled = true;
            }

            // get the default provider
            XmlElement e = wc.GetProviderSection(sectionName);

            if (e != null)
            {
                //OrininallyEnabled property should be true just when the current provider is already configured as default
                string currentProvider = e.GetAttribute("defaultProvider");
                if (!currentProvider.Equals(typeName, StringComparison.InvariantCultureIgnoreCase))
                {
                    DefaultProvider   = typeName;
                    OriginallyEnabled = false;
                }
                else
                {
                    DefaultProvider   = currentProvider;
                    OriginallyEnabled = true;
                }
            }

            e = wc.GetProviderElement(sectionName);
            if (e != null)
            {
                //use the ProviderName configured just when is the current Provider, because this will cause conflicts when two providers are in the same section with a different name
                if (e.HasAttribute("name"))
                {
                    string providerName = e.GetAttribute("name");
                    values.ProviderName = !OriginallyEnabled ? typeName : providerName;
                }
                if (e.HasAttribute("connectionStringName"))
                {
                    values.ConnectionStringName = e.GetAttribute("connectionStringName");
                }
                if (e.HasAttribute("description"))
                {
                    values.AppDescription = e.GetAttribute("description");
                }
                if (e.HasAttribute("applicationName"))
                {
                    values.AppName = e.GetAttribute("applicationName");
                }
                if (e.HasAttribute("writeExceptionsToEventLog"))
                {
                    values.WriteExceptionToLog = GetBoolValue(e.GetAttribute("writeExceptionsToEventLog"), false);
                }
                if (e.HasAttribute("autogenerateschema"))
                {
                    values.AutoGenSchema = GetBoolValue(e.GetAttribute("autogenerateschema"), false);
                }
                if (e.HasAttribute("enableExpireCallback"))
                {
                    values.EnableExpireCallback = GetBoolValue(e.GetAttribute("enableExpireCallback"), false);
                }
            }
            values.ConnectionString = wc.GetConnectionString(values.ConnectionStringName);
            //enable the provider by default just when it was already configured as default
            Enabled = OriginallyEnabled;
            //Enabled = OriginallyEnabled = DefaultProvider != null && (DefaultProvider == values.ProviderName || DefaultProvider == defaults.ProviderName);
        }
예제 #6
0
        public override void Initialize(WebConfig wc)
        {
            GetDefaults();
            values = defaults;
            if (string.IsNullOrEmpty(values.ProviderName))
            {
                NotInstalled = true;
            }


            //Personalization provider needs membership enabled
            XmlElement membership = wc.GetProviderSection("membership");

            if (membership == null || membership.Attributes["defaultProvider"] == null ||
                !membership.Attributes["defaultProvider"].Value.Equals("MySQLMembershipProvider", StringComparison.InvariantCultureIgnoreCase))
            {
                _membershipEnabled = false;
                return;
            }
            else
            {
                _membershipEnabled = true;
            }

            // get the default provider
            XmlElement e = wc.GetProviderSection(sectionName);

            if (e == null || e.FirstChild == null)
            {
                return;
            }

            var personalizationNode = e.FirstChild as XmlElement; // move to the <personalization> element

            if (personalizationNode == null || personalizationNode.FirstChild == null)
            {
                return;
            }

            string defaultProvider = personalizationNode.GetAttribute("defaultProvider");


            Enabled = OriginallyEnabled = defaultProvider != null &&
                                          (defaultProvider == values.ProviderName || defaultProvider == defaults.ProviderName);

            e = wc.GetProviderElement(sectionName);
            if (e != null)
            {
                values.ProviderName = e.GetAttribute("name");
                if (e.HasAttribute("connectionStringName"))
                {
                    values.ConnectionStringName = e.GetAttribute("connectionStringName");
                }
                if (e.HasAttribute("description"))
                {
                    values.AppDescription = e.GetAttribute("description");
                }
                if (e.HasAttribute("applicationName"))
                {
                    values.AppName = e.GetAttribute("applicationName");
                }
                if (e.HasAttribute("writeExceptionsToEventLog"))
                {
                    values.WriteExceptionToLog = GetBoolValue(e.GetAttribute("writeExceptionsToEventLog"), false);
                }
                if (e.HasAttribute("autogenerateschema"))
                {
                    values.AutoGenSchema = GetBoolValue(e.GetAttribute("autogenerateschema"), false);
                }
            }
            values.ConnectionString = wc.GetConnectionString(values.ConnectionStringName);
        }
예제 #7
0
        public override void Initialize(WebConfig wc)
        {
            base.Initialize(wc);

            XmlElement e = wc.GetProviderSection(sectionName);

            if (e != null)
            {
                string currentProvider = e.GetAttribute("defaultProvider");
                if (!currentProvider.Equals(typeName, StringComparison.InvariantCultureIgnoreCase))
                {
                    base.DefaultProvider = typeName;
                    OriginallyEnabled    = false;
                }
                else
                {
                    base.DefaultProvider = currentProvider;
                    OriginallyEnabled    = true;
                }
            }

            e = wc.GetProviderElement(sectionName);
            if (e != null)
            {
                if (e.HasAttribute("name"))
                {
                    string providerName = e.GetAttribute("name");
                    base.values.ProviderName = !OriginallyEnabled ? typeName : providerName;
                }
                if (e.HasAttribute("connectionStringName"))
                {
                    string connStrName = e.GetAttribute("connectionStringName");
                    base.values.ConnectionStringName = !OriginallyEnabled ? "LocalMySqlServer" : connStrName;
                }
                if (e.HasAttribute("description"))
                {
                    base.values.AppDescription = e.GetAttribute("description");
                }
                if (e.HasAttribute("applicationName"))
                {
                    base.values.AppName = e.GetAttribute("applicationName");
                }
            }
            base.values.ConnectionString = wc.GetConnectionString(base.values.ConnectionStringName);

            NotInstalled = !_mySqlSimpleMembershipFound;

            Enabled = OriginallyEnabled;

            values = defaults;
            e      = wc.GetProviderElement(sectionName);
            if (e == null)
            {
                return;
            }

            if (e.HasAttribute("userTableName"))
            {
                values.UserTableName = e.GetAttribute("userTableName");
            }
            if (e.HasAttribute("userIdColumn"))
            {
                values.UserIdColumn = e.GetAttribute("userIdColumn");
            }
            if (e.HasAttribute("userNameColumn"))
            {
                values.UserNameColumn = e.GetAttribute("userNameColumn");
            }
            if (e.HasAttribute("autoGenerateTables"))
            {
                values.AutoGenerateTables = Convert.ToBoolean(e.GetAttribute("autoGenerateTables"));
            }
        }