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; } }