示例#1
0
        public ClsDBAccessor(AggregateSeries series, ClsSummaryDB summDB)
        {
            this.summaryDB = summDB;
            if (series.L1DBInitialCatalog != null && series.L1DBInitialCatalog != string.Empty)
            {
                SqlConnectionStringBuilder builder = new SqlConnectionStringBuilder();
                builder.DataSource          = series.L1DBDataSource;     // drought.usu.edu
                builder.InitialCatalog      = series.L1DBInitialCatalog; // Summary
                builder.PersistSecurityInfo = true;
                builder.UserID   = series.L1DBUsername;
                builder.Password = series.L1DBPassword;
                builder.MultipleActiveResultSets = true;
                //// builder.IntegratedSecurity = true;
                string providerString = builder.ToString();

                EntityConnectionStringBuilder fromConnection = new EntityConnectionStringBuilder();
                fromConnection.Metadata = "res://*/SummaryModel.csdl|res://*/SummaryModel.ssdl|res://*/SummaryModel.msl";//"res://*/ODMModel.csdl|res://*/ODMModel.ssdl|res://*/ODMModel.msl";//"res://*/SummaryModel.csdl|res://*/SummaryModel.ssdl|res://*/SummaryModel.msl";
                fromConnection.Provider = "System.Data.SqlClient";
                fromConnection.ProviderConnectionString = providerString;

                this.fromDB = new ClsFromDB(fromConnection.ConnectionString);
            }
            else
            {
                this.fromDB = new ClsFromDB();
            }

            if (series.DBInitialCatalog != null && series.DBInitialCatalog != string.Empty)
            {
                SqlConnectionStringBuilder builder = new SqlConnectionStringBuilder();
                builder.DataSource          = series.DBDataSource;     // drought.usu.edu
                builder.InitialCatalog      = series.DBInitialCatalog; // Summary
                builder.PersistSecurityInfo = true;
                builder.UserID   = series.DBUsername;
                builder.Password = series.DBPassword;
                builder.MultipleActiveResultSets = true;
                //// builder.IntegratedSecurity = true;
                string providerString = builder.ToString();

                EntityConnectionStringBuilder tooConnection = new EntityConnectionStringBuilder();
                tooConnection.Metadata = "res://*/SummaryModel.csdl|res://*/SummaryModel.ssdl|res://*/SummaryModel.msl";//"res://*/ODMModel.csdl|res://*/ODMModel.ssdl|res://*/ODMModel.msl";//
                tooConnection.Provider = "System.Data.SqlClient";
                tooConnection.ProviderConnectionString = providerString;
                this.tooDB = new ClsTooDB(tooConnection.ConnectionString);
            }
            else
            {
                this.tooDB = new ClsTooDB();
            }
        }
示例#2
0
 public ClsDBAccessor()
 {
     this.summaryDB = new ClsSummaryDB();
     this.fromDB    = new ClsFromDB();
     this.tooDB     = new ClsTooDB();
 }