@@ -84,59 +84,20 @@ public static IHostBuilder CreateHostBuilder(string[] args) =>
8484 }
8585 services . AddSingleton < ConfigService > ( ) ;
8686
87- string acid = "" ;
88- if ( environmentVariables . Contains ( "acid" ) )
89- {
90- acid = environmentVariables [ "acid" ] as string ;
91- }
92- else
93- {
94- acid = configuration . GetConnectionString ( "acid" ) ;
95- }
96- string baseConnection = "" ;
97- if ( environmentVariables . Contains ( "base" ) )
98- {
99- baseConnection = environmentVariables [ "base" ] as string ;
100- }
101- else
87+ if ( bdType . Equals ( "0" ) )
10288 {
103- baseConnection = configuration . GetConnectionString ( "base" ) ;
89+ services . AddDbContext < EntityContext > ( ) ;
90+ services . AddDbContext < EntityContextBASE > ( ) ;
10491 }
105- if ( bdType . Equals ( "0 " ) )
92+ else if ( bdType . Equals ( "1 " ) )
10693 {
107- services . AddDbContext < EntityContext > ( options =>
108- options . UseSqlServer ( acid , o => o . UseCompatibilityLevel ( 110 ) )
109- ) ;
110- services . AddDbContext < EntityContextBASE > ( options =>
111- options . UseSqlServer ( baseConnection , o => o . UseCompatibilityLevel ( 110 ) )
112- ) ;
94+ services . AddDbContext < EntityContext , EntityContextOracle > ( ) ;
95+ services . AddDbContext < EntityContextBASE , EntityContextBASEOracle > ( ) ;
11396 }
114- else if ( bdType . Equals ( "1" ) )
115- {
116- services . AddDbContext < EntityContext , EntityContextOracle > ( options =>
117- options . UseOracle ( acid )
118- ) ;
119- services . AddDbContext < EntityContextBASE , EntityContextBASEOracle > ( options =>
120- options . UseOracle ( baseConnection )
121-
122- ) ;
123- }
124- else if ( bdType . Equals ( "2" ) )
97+ else if ( bdType . Equals ( "2" ) )
12598 {
126- services . AddDbContext < EntityContext , EntityContextPostgres > ( opt =>
127- {
128- var builder = new NpgsqlDbContextOptionsBuilder ( opt ) ;
129- builder . SetPostgresVersion ( new Version ( 9 , 6 ) ) ;
130- opt . UseNpgsql ( acid ) ;
131-
132- } ) ;
133- services . AddDbContext < EntityContextBASE , EntityContextBASEPostgres > ( opt =>
134- {
135- var builder = new NpgsqlDbContextOptionsBuilder ( opt ) ;
136- builder . SetPostgresVersion ( new Version ( 9 , 6 ) ) ;
137- opt . UseNpgsql ( baseConnection ) ;
138-
139- } ) ;
99+ services . AddDbContext < EntityContext , EntityContextPostgres > ( ) ;
100+ services . AddDbContext < EntityContextBASE , EntityContextBASEPostgres > ( ) ;
140101 }
141102 services . AddHostedService < SocialCacheRefreshWorker > ( ) ;
142103 } ) ;
0 commit comments