28 lines
898 B
C#
28 lines
898 B
C#
using System.Reflection;
|
||
using FluentValidation;
|
||
using MediatR;
|
||
using Microsoft.Extensions.DependencyInjection;
|
||
using TakeoutSaaS.Application.App.Common.Behaviors;
|
||
|
||
namespace TakeoutSaaS.Application.App.Extensions;
|
||
|
||
/// <summary>
|
||
/// 业务应用层服务注册。
|
||
/// </summary>
|
||
public static class AppApplicationServiceCollectionExtensions
|
||
{
|
||
/// <summary>
|
||
/// 注册业务应用层(MediatR 处理器等)。
|
||
/// </summary>
|
||
/// <param name="services">服务集合。</param>
|
||
/// <returns>服务集合。</returns>
|
||
public static IServiceCollection AddAppApplication(this IServiceCollection services)
|
||
{
|
||
services.AddMediatR(Assembly.GetExecutingAssembly());
|
||
services.AddValidatorsFromAssembly(Assembly.GetExecutingAssembly());
|
||
services.AddTransient(typeof(IPipelineBehavior<,>), typeof(ValidationBehavior<,>));
|
||
|
||
return services;
|
||
}
|
||
}
|