22
33public static class DependencyInjection
44{
5- #region "SERILOG"
65 public static IServiceCollection AddSerilogServices ( this IServiceCollection services )
76 {
87 services . AddTransient < ILoggerService , LoggerService > ( ) ;
@@ -29,9 +28,7 @@ public static WebApplicationBuilder AddSerilogOptionsBuilder(this WebApplication
2928
3029 return builder ;
3130 }
32- #endregion
3331
34- #region "MULTI LANGUAGE"
3532 public static IServiceCollection AddSupportedCultures ( this IServiceCollection services , string [ ] cultures )
3633 {
3734 var supportedCultures = cultures ;
@@ -56,9 +53,7 @@ public static WebApplication UseLocalizationConfiguration(this WebApplication ap
5653
5754 return app ;
5855 }
59- #endregion
6056
61- #region "DATE and TIME ONLY"
6257 public static IMvcBuilder AddDateTimeJsonOptions ( this IMvcBuilder builder )
6358 {
6459 builder . AddJsonOptions ( options =>
@@ -98,9 +93,7 @@ public static SwaggerGenOptions AddDateTimeSwaggerGenOptions(this SwaggerGenOpti
9893
9994 return options ;
10095 }
101- #endregion
10296
103- #region "JSON"
10497 public static IMvcBuilder AddSimpleJsonOptions ( this IMvcBuilder builder )
10598 {
10699 builder . AddJsonOptions ( options =>
@@ -109,9 +102,7 @@ public static IMvcBuilder AddSimpleJsonOptions(this IMvcBuilder builder)
109102 } ) ;
110103 return builder ;
111104 }
112- #endregion
113105
114- #region "EFCORE DBContext Generics"
115106 public static IServiceCollection AddDbContextGenericsMethods < TDbContext > ( this IServiceCollection services ) where TDbContext : DbContext
116107 {
117108 services . AddScoped < DbContext , TDbContext > ( ) ;
@@ -121,9 +112,7 @@ public static IServiceCollection AddDbContextGenericsMethods<TDbContext>(this IS
121112
122113 return services ;
123114 }
124- #endregion
125115
126- #region "EFCORE DBContext"
127116 public static IServiceCollection AddDbContextUseMySql < TDbContext > ( this IServiceCollection services , string connectionString , int retryOnFailure ) where TDbContext : DbContext
128117 {
129118 services . AddDbContextPool < TDbContext > ( optionBuilder =>
@@ -144,9 +133,7 @@ public static IServiceCollection AddDbContextUseMySql<TDbContext>(this IServiceC
144133 } ) ;
145134 return services ;
146135 }
147- #endregion
148136
149- #region "DATABASE HEALTH CHECKS"
150137 public static IServiceCollection AddMySqlHealthChecks ( this IServiceCollection services , string connectionString , string nameAsyncCheck )
151138 {
152139 services . AddHealthChecks ( )
@@ -213,9 +200,7 @@ public static IEndpointRouteBuilder AddDatabaseHealthChecks(this IEndpointRouteB
213200
214201 return builder ;
215202 }
216- #endregion
217203
218- #region "MAILKIT"
219204 public static IServiceCollection AddMailKitEmailSenderService ( this IServiceCollection services , IConfiguration configuration )
220205 {
221206 services
@@ -227,5 +212,4 @@ public static IServiceCollection AddMailKitEmailSenderService(this IServiceColle
227212
228213 return services ;
229214 }
230- #endregion
231215}
0 commit comments