feat: создана структура проекта, core, domain, infrastructure. Перенесены enum и task согласно архитектуры
This commit is contained in:
44
PARR.Core/DependencyInjection.cs
Normal file
44
PARR.Core/DependencyInjection.cs
Normal file
@@ -0,0 +1,44 @@
|
||||
using FluentValidation;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
|
||||
namespace PARR.Core
|
||||
{
|
||||
public static class DependencyInjection
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Регистрация Core (BLL) сервисов
|
||||
/// </summary>
|
||||
/// <param name="services"></param>
|
||||
/// <param name="configuration"></param>
|
||||
/// <returns></returns>
|
||||
public static IServiceCollection AddCoreServices(this IServiceCollection services, IConfiguration configuration)
|
||||
{
|
||||
// Регим профили AutoMapper
|
||||
services.AddBllMapping();
|
||||
|
||||
// Регим все валидаторы в Core
|
||||
services.AddValidatorsFromAssembly(typeof(DependencyInjection).Assembly, includeInternalTypes: true);
|
||||
|
||||
// Регистрируем сревисы Core
|
||||
//services.AddScoped<IUserService, UserService>();
|
||||
|
||||
return services;
|
||||
}
|
||||
|
||||
|
||||
private static IServiceCollection AddBllMapping(this IServiceCollection services)
|
||||
{
|
||||
// AutoMapper
|
||||
services.AddAutoMapper(cfg =>
|
||||
{
|
||||
// регим все в Core
|
||||
cfg.AddMaps(typeof(DependencyInjection).Assembly);
|
||||
});
|
||||
|
||||
return services;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user