@@ -69,14 +69,39 @@ public static ConfigurationOptions GetRedisConfigurationOptions(this Configurati
6969 return configurationOptions ;
7070 }
7171
72+ public static IServiceCollection AddOpenShockMemDB ( this IServiceCollection services , ConfigurationOptions options )
73+ {
74+ // <---- Redis ---->
75+ services . AddSingleton < IConnectionMultiplexer > ( ConnectionMultiplexer . Connect ( options ) ) ;
76+ services . AddSingleton < IRedisConnectionProvider , RedisConnectionProvider > ( ) ;
77+ services . AddSingleton < IRedisPubService , RedisPubService > ( ) ;
78+
79+ return services ;
80+ }
81+
82+ public static IServiceCollection AddOpenShockDB ( this IServiceCollection services , DatabaseOptions options )
83+ {
84+ // <---- Postgres EF Core ---->
85+ services . AddDbContextPool < OpenShockContext > ( builder => OpenShockContext . ConfigureOptionsBuilder ( builder , options . Conn , options . Debug ) ) ;
86+ services . AddPooledDbContextFactory < OpenShockContext > ( builder =>
87+ {
88+ builder . UseNpgsql ( options . Conn ) ;
89+ if ( options . Debug )
90+ {
91+ builder . EnableSensitiveDataLogging ( ) ;
92+ builder . EnableDetailedErrors ( ) ;
93+ }
94+ } ) ;
95+
96+ return services ;
97+ }
98+
7299 /// <summary>
73100 /// Register all OpenShock services for PRODUCTION use
74101 /// </summary>
75102 /// <param name="services"></param>
76- /// <param name="databaseOptions"></param>
77- /// <param name="redisConfigurationOptions"></param>
78103 /// <returns></returns>
79- public static IServiceCollection AddOpenShockServices ( this IServiceCollection services , DatabaseOptions databaseOptions , ConfigurationOptions redisConfigurationOptions )
104+ public static IServiceCollection AddOpenShockServices ( this IServiceCollection services )
80105 {
81106 // <---- ASP.NET ---->
82107 services . AddExceptionHandler < OpenShockExceptionHandler > ( ) ;
@@ -169,23 +194,6 @@ public static IServiceCollection AddOpenShockServices(this IServiceCollection se
169194 . AddAspNetCoreInstrumentation ( )
170195 . AddHttpClientInstrumentation ( )
171196 . AddPrometheusExporter ( ) ) ;
172-
173- // <---- Redis ---->
174- services . AddSingleton < IConnectionMultiplexer > ( ConnectionMultiplexer . Connect ( redisConfigurationOptions ) ) ;
175- services . AddSingleton < IRedisConnectionProvider , RedisConnectionProvider > ( ) ;
176- services . AddSingleton < IRedisPubService , RedisPubService > ( ) ;
177-
178- // <---- Postgres EF Core ---->
179- services . AddDbContextPool < OpenShockContext > ( builder => OpenShockContext . ConfigureOptionsBuilder ( builder , databaseOptions . Conn , databaseOptions . Debug ) ) ;
180- services . AddPooledDbContextFactory < OpenShockContext > ( builder =>
181- {
182- builder . UseNpgsql ( databaseOptions . Conn ) ;
183- if ( databaseOptions . Debug )
184- {
185- builder . EnableSensitiveDataLogging ( ) ;
186- builder . EnableDetailedErrors ( ) ;
187- }
188- } ) ;
189197
190198 // <---- OpenShock Services ---->
191199
0 commit comments