Newer
Older
Warehouse / src / Application / ApplicationStartup.cs
@Derek Comartin Derek Comartin on 22 Aug 2023 704 bytes Init
using Microsoft.Extensions.DependencyInjection;
using MyWarehouse.Application.Common.Behaviors;
using System.Reflection;

namespace MyWarehouse.Application;

public static class ApplicationStartup
{
    public static void AddMyApplicationDependencies(this IServiceCollection services)
    {
        services.AddAutoMapper(Assembly.GetExecutingAssembly());
        services.AddValidatorsFromAssembly(Assembly.GetExecutingAssembly());
        services.AddMediatR(Assembly.GetExecutingAssembly());

        services.AddTransient(typeof(IPipelineBehavior<,>), typeof(ExceptionLoggingBehavior<,>));
        services.AddTransient(typeof(IPipelineBehavior<,>), typeof(RequestValidationBehavior<,>));
    }
}