autobus-api_old/AutobusApi.Application/DependencyInjection.cs
2023-11-30 16:18:07 +02:00

26 lines
765 B
C#

using System.Reflection;
using AutobusApi.Application.Common.Behaviours;
using FluentValidation;
using MediatR;
using Microsoft.Extensions.DependencyInjection;
namespace AutobusApi.Application;
public static class DependencyInjection
{
public static IServiceCollection AddApplication(this IServiceCollection services)
{
services.AddValidatorsFromAssembly(Assembly.GetExecutingAssembly());
services.AddAutoMapper(Assembly.GetExecutingAssembly());
services.AddMediatR(configuration =>
{
configuration.RegisterServicesFromAssembly(Assembly.GetExecutingAssembly());
configuration.AddBehavior(typeof(IPipelineBehavior<,>), typeof(ValidationBehaviour<,>));
});
return services;
}
}