Esempio n. 1
0
        private bool SavePageData()
        {
            if (!IsValidData())
            {
                return(false);
            }

            GenericConfig config = pages[page].ProviderConfig;

            if (IsSimpleMembershipPage && useProvider.Checked)
            {
                SimpleMembershipOptions options = new SimpleMembershipOptions();
                options.AutoGenerateTables = chbAutoGenTbl.Checked;
                options.UserTableName      = txtUserTable.Text;
                options.UserIdColumn       = txtUserIdCol.Text;
                options.UserNameColumn     = txtUserNameCol.Text;
                ((SimpleMembershipConfig)pages[SimpleMembershipIndex].ProviderConfig).SimpleMemberOptions = options;
                config.Enabled = useProvider.Checked;
            }

            if (IsEntityFrameworkPage && useProvider.Checked)
            {
                EntityFrameworkOptions options = new EntityFrameworkOptions();
                options.EF5 = radioBtnEF5.Checked;
                options.EF6 = radioBtnEF6.Checked;
                ((EntityFrameworkConfig)pages[ENTITYFRAMEWORK_INDEX].ProviderConfig).EntityFrameworkOptions = options;
                config.Enabled = useProvider.Checked;
            }

            Options o = config.GenericOptions;

            o.AppName              = appName.Text;
            o.AppDescription       = appDescription.Text.Trim();
            o.WriteExceptionToLog  = writeExToLog.Checked;
            o.AutoGenSchema        = autogenSchema.Checked;
            o.EnableExpireCallback = enableExpCallback.Checked;
            o.ConnectionString     = (IsSimpleMembershipPage && useProvider.Checked) ? txtConnStringSM.Text.Trim() : connectionString.Text.Trim();
            o.ConnectionStringName = (IsSimpleMembershipPage && useProvider.Checked) ? txtConnStringName.Text.Trim() : o.ConnectionStringName;
            config.GenericOptions  = o;
            return(true);
        }
Esempio n. 2
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"));
            }
        }