コード例 #1
0
ファイル: SqlConn.cs プロジェクト: lowonion/DataShow
        public SqlConnect GetSqlConn(string name = null)
        {
            name = name ?? MultiTenantHostName;
            var sqlConn = ConnectionStrings.First(o => o.Name == name);

            sqlConn.ProviderName = sqlConn.ProviderName ?? DefaultProviderName;
            return(sqlConn);
        }
コード例 #2
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());
            }
        }