27 lines
990 B
C#
27 lines
990 B
C#
using System.Reflection;
|
|
using Hutopy.Application.Common.Behaviours;
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
|
|
namespace Hutopy.Application;
|
|
|
|
public static class DependencyInjection
|
|
{
|
|
public static IServiceCollection AddApplicationServices(this IServiceCollection services)
|
|
{
|
|
services.AddAutoMapper(Assembly.GetExecutingAssembly());
|
|
|
|
services.AddValidatorsFromAssembly(Assembly.GetExecutingAssembly());
|
|
|
|
services.AddMediatR(cfg =>
|
|
{
|
|
cfg.RegisterServicesFromAssembly(Assembly.GetExecutingAssembly());
|
|
//cfg.AddBehavior(typeof(IPipelineBehavior<,>), typeof(UnhandledExceptionBehaviour<,>));
|
|
cfg.AddBehavior(typeof(IPipelineBehavior<,>), typeof(AuthorizationBehaviour<,>));
|
|
//cfg.AddBehavior(typeof(IPipelineBehavior<,>), typeof(ValidationBehaviour<,>));
|
|
//cfg.AddBehavior(typeof(IPipelineBehavior<,>), typeof(PerformanceBehaviour<,>));
|
|
});
|
|
|
|
return services;
|
|
}
|
|
}
|