Example #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);
        }
Example #2
0
        /// <summary>
        /// Initializes the specified web config object, setting the Entity Framework section and the config section of the config file.
        /// </summary>
        /// <param name="wc">The Webconfig object.</param>
        public override void Initialize(WebConfig wc)
        {
            _entityFrameworkEnabled = false;
            XmlElement entityFramework = wc.GetProviderSection("entityFramework");
            XmlElement configSections  = wc.GetProviderSection("configSections");

            if (entityFramework != null)
            {
                XElement entityFrameworkSection = XElement.Parse(entityFramework.OuterXml);
                XElement mySQLEFProvider        = entityFrameworkSection.Elements("defaultConnectionFactory")
                                                  .FirstOrDefault(a => a.Attribute("type") != null && a.Attribute("type").Value.Contains("MySql.Data.Entity"));
                if (mySQLEFProvider != null)
                {
                    _entityFrameworkEnabled = true;
                }
            }

            Enabled = OriginallyEnabled = _entityFrameworkEnabled;
            XElement configSectionXElement = configSections != null?XElement.Parse(configSections.OuterXml) : null;

            SetDefaults(configSectionXElement);
            values = defaults;
        }
Example #3
0
        private void PageChanged()
        {
            pageLabel.Text   = pages[page].Title;
            pageDesc.Text    = pages[page].Description;
            useProvider.Text = pages[page].EnabledString;
            GenericConfig config = pages[page].ProviderConfig;
            Options       o      = config.GenericOptions;

            appName.Text              = o.AppName;
            useProvider.Checked       = config.Enabled;
            appDescription.Text       = o.AppDescription;
            writeExToLog.Checked      = o.WriteExceptionToLog;
            autogenSchema.Checked     = o.AutoGenSchema;
            enableExpCallback.Checked = o.EnableExpireCallback;
            controlPanel.Enabled      = config.Enabled;

            if (IsEntityFrameworkPage)
            {
                EntityFrameworkOptions options = ((EntityFrameworkConfig)pages[ENTITYFRAMEWORK_INDEX].ProviderConfig).EntityFrameworkOptions;
                radioBtnEF5.Checked = options.EF5;
                radioBtnEF6.Checked = options.EF6;
            }
            else
            {
                if (IsSimpleMembershipPage)
                {
                    txtConnStringSM.Text = o.ConnectionString;
                }
                else
                {
                    connectionString.Text = o.ConnectionString;
                }
            }

            advancedBtn.Visible       = page == 0;
            writeExToLog.Visible      = page != 3;
            enableExpCallback.Visible = page == 4;
            nextButton.Text           = (page == pages.Length - 1) ? "Finish" : "Next";
            backButton.Enabled        = page > 0;

            if (page == PERSONALIZATION_INDEX)
            {
                useProvider.Enabled = IsMembershipSelected();
            }
            else
            {
                useProvider.Enabled = true;
            }

            if (config.NotInstalled)
            {
                useProvider.Checked = false;
                useProvider.Enabled = false;
            }

            if (IsEntityFrameworkPage)
            {
                pnlSimpleMembership.Visible  = false;
                controlPanel.Visible         = false;
                entityFrameworkPanel.Visible = true;
                entityFrameworkPanel.Enabled = config.Enabled;
            }
            else
            {
                entityFrameworkPanel.Visible = false;
                entityFrameworkPanel.Enabled = false;

                if (IsSimpleMembershipPage)
                {
                    pnlSimpleMembership.Visible = true;
                    controlPanel.Visible        = false;

                    if (config.NotInstalled)
                    {
                        useProvider.Enabled         = false;
                        useProvider.Checked         = false;
                        pnlSimpleMembership.Enabled = false;
                    }
                    else
                    {
                        useProvider.Enabled = !IsMembershipSelected();
                        if (config.Enabled && IsMembershipSelected())
                        {
                            useProvider.Checked = false;
                        }
                    }
                }
                else
                {
                    pnlSimpleMembership.Visible = false;
                    controlPanel.Visible        = true;
                }
            }
        }