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;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
27
PARR.Core/PARR.Core.csproj
Normal file
27
PARR.Core/PARR.Core.csproj
Normal file
@@ -0,0 +1,27 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net7.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="Infrastructure\" />
|
||||
<Folder Include="Common\" />
|
||||
<Folder Include="Services\" />
|
||||
<Folder Include="Repositories\" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="AutoMapper.Extensions.Microsoft.DependencyInjection" Version="12.0.1" />
|
||||
<PackageReference Include="FluentValidation.DependencyInjectionExtensions" Version="11.5.2" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="7.0.20" />
|
||||
<PackageReference Include="Microsoft.Extensions.Hosting" Version="7.0.1" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\PARR.Domain\PARR.Domain.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
Reference in New Issue
Block a user