2024-01-08 15:04:34 +03:00
|
|
|
using FluentValidation;
|
2024-01-08 16:11:01 +03:00
|
|
|
using MediatR;
|
2024-01-08 15:04:34 +03:00
|
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
|
|
using Mirea.Api.DataAccess.Application.Common.Behaviors;
|
2024-01-08 16:11:01 +03:00
|
|
|
using System.Reflection;
|
2024-01-08 15:04:34 +03:00
|
|
|
|
|
|
|
namespace Mirea.Api.DataAccess.Application;
|
|
|
|
|
|
|
|
public static class DependencyInjection
|
|
|
|
{
|
|
|
|
public static IServiceCollection AddApplication(this IServiceCollection services)
|
|
|
|
{
|
|
|
|
services.AddMediatR(cfg => cfg.RegisterServicesFromAssembly(Assembly.GetExecutingAssembly()));
|
|
|
|
services.AddValidatorsFromAssemblies(new[] { Assembly.GetExecutingAssembly() });
|
|
|
|
services.AddTransient(typeof(IPipelineBehavior<,>),
|
|
|
|
typeof(ValidationBehavior<,>));
|
|
|
|
return services;
|
|
|
|
}
|
|
|
|
}
|