Merge pull request #45 from meysamhadeli/develop

Develop
This commit is contained in:
Meysam Hadeli 2022-09-06 17:52:15 +04:30 committed by GitHub
commit 0dfd45f33e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 32 additions and 34 deletions

View File

@ -1,23 +1,23 @@
using BuildingBlocks.Core; using BuildingBlocks.Core;
using BuildingBlocks.Utils; using BuildingBlocks.Utils;
using BuildingBlocks.Web; using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
namespace Booking.Extensions; namespace Booking.Extensions;
public static class CoreExtensions public static class CoreExtensions
{ {
public static IServiceCollection AddCore(this IServiceCollection services, IConfiguration configuration) public static IServiceCollection AddCore(this IServiceCollection services)
{ {
services.AddOptions<AppOptions>()
.Bind(configuration.GetSection(nameof(AppOptions)))
.ValidateDataAnnotations();
services.AddScoped<ICurrentUserProvider, CurrentUserProvider>(); services.AddScoped<ICurrentUserProvider, CurrentUserProvider>();
services.AddTransient<IEventMapper, EventMapper>(); services.AddScoped<IEventMapper, EventMapper>();
services.AddScoped<IEventDispatcher, EventDispatcher>(); services.AddScoped<IEventDispatcher, EventDispatcher>();
services.Configure<ApiBehaviorOptions>(options =>
{
options.SuppressModelStateInvalidFilter = true;
});
return services; return services;
} }
} }

View File

@ -1,23 +1,23 @@
using BuildingBlocks.Core; using BuildingBlocks.Core;
using BuildingBlocks.Utils; using BuildingBlocks.Utils;
using BuildingBlocks.Web; using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
namespace Flight.Extensions; namespace Flight.Extensions;
public static class CoreExtensions public static class CoreExtensions
{ {
public static IServiceCollection AddCore(this IServiceCollection services, IConfiguration configuration) public static IServiceCollection AddCore(this IServiceCollection services)
{ {
services.AddOptions<AppOptions>()
.Bind(configuration.GetSection(nameof(AppOptions)))
.ValidateDataAnnotations();
services.AddScoped<ICurrentUserProvider, CurrentUserProvider>(); services.AddScoped<ICurrentUserProvider, CurrentUserProvider>();
services.AddTransient<IEventMapper, EventMapper>(); services.AddScoped<IEventMapper, EventMapper>();
services.AddScoped<IEventDispatcher, EventDispatcher>(); services.AddScoped<IEventDispatcher, EventDispatcher>();
services.Configure<ApiBehaviorOptions>(options =>
{
options.SuppressModelStateInvalidFilter = true;
});
return services; return services;
} }
} }

View File

@ -1,21 +1,21 @@
using BuildingBlocks.Core; using BuildingBlocks.Core;
using BuildingBlocks.Web; using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
namespace Identity.Extensions; namespace Identity.Extensions;
public static class CoreExtensions public static class CoreExtensions
{ {
public static IServiceCollection AddCore(this IServiceCollection services, IConfiguration configuration) public static IServiceCollection AddCore(this IServiceCollection services)
{ {
services.AddOptions<AppOptions>() services.AddScoped<IEventMapper, EventMapper>();
.Bind(configuration.GetSection(nameof(AppOptions)))
.ValidateDataAnnotations();
services.AddTransient<IEventMapper, EventMapper>();
services.AddScoped<IEventDispatcher, EventDispatcher>(); services.AddScoped<IEventDispatcher, EventDispatcher>();
services.Configure<ApiBehaviorOptions>(options =>
{
options.SuppressModelStateInvalidFilter = true;
});
return services; return services;
} }
} }

View File

@ -1,25 +1,23 @@
using BuildingBlocks.Core; using BuildingBlocks.Core;
using BuildingBlocks.Utils; using BuildingBlocks.Utils;
using BuildingBlocks.Web; using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
namespace Passenger.Extensions; namespace Passenger.Extensions;
public static class CoreExtensions public static class CoreExtensions
{ {
public static IServiceCollection AddCore(this IServiceCollection services, IConfiguration configuration) public static IServiceCollection AddCore(this IServiceCollection services)
{ {
configuration.GetSection(nameof(AppOptions)).Bind(nameof(AppOptions));
services.AddOptions<AppOptions>()
.Bind(configuration.GetSection(nameof(AppOptions)))
.ValidateDataAnnotations();
services.AddScoped<ICurrentUserProvider, CurrentUserProvider>(); services.AddScoped<ICurrentUserProvider, CurrentUserProvider>();
services.AddTransient<IEventMapper, EventMapper>(); services.AddScoped<IEventMapper, EventMapper>();
services.AddScoped<IEventDispatcher, EventDispatcher>(); services.AddScoped<IEventDispatcher, EventDispatcher>();
services.Configure<ApiBehaviorOptions>(options =>
{
options.SuppressModelStateInvalidFilter = true;
});
return services; return services;
} }
} }