コード例 #1
0
        protected override void LoadMigrators()
        {
            base.LoadMigrators();

            if (Migrators.Count() > 1)
            {
                lblMigrationTarget.Visible = false;

                cmbMigrationTarget.Visible               = true;
                cmbMigrationTarget.DataSource            = new BindingSource(Migrators, null);
                cmbMigrationTarget.DisplayMember         = "Key";
                cmbMigrationTarget.ValueMember           = "Key";
                cmbMigrationTarget.SelectedIndexChanged += cmbMigrationTarget_SelectedIndexChanged;
            }
            else if (Migrators.Count() == 1)
            {
                cmbMigrationTarget.Visible = false;
                lblMigrationTarget.Visible = true;
            }

            if (ConnectionStrings.Count() > 1)
            {
                lblConnectionString.Visible = false;

                cmbConnectionString.Visible = true;
                cmbConnectionString.Items.AddRange(ConnectionStrings.Select(x => x.Name).ToArray());
                cmbConnectionString.SelectedIndexChanged += cmbConnectionString_SelectedIndexChanged;
                cmbConnectionString.Text = ConnectionStrings.First().Name;
            }
            else
            {
                lblConnectionString.Visible = true;
                cmbConnectionString.Visible = false;
                lblConnectionString.Text    = GetConnectionStringDisplay(ConnectionStrings.Single());
            }
        }