AutoMapperInstaller.cs
777 Bytes
using System.Reflection;
using AutoMapper;
using Microsoft.Extensions.DependencyInjection;
namespace Rcs.Infrastructure.Installs
{
/// <summary>
/// AutoMapper 服务安装器
/// </summary>
public static class AutoMapperInstaller
{
/// <summary>
/// 安装 AutoMapper 服务
/// </summary>
/// <param name="services">服务集合</param>
/// <returns>服务集合</returns>
public static IServiceCollection InstallAutoMapper(this IServiceCollection services)
{
// 添加 AutoMapper 服务,自动扫描程序集中的 Profile
services.AddAutoMapper(Assembly.GetAssembly(typeof(Rcs.Application.Common.Mapping.MappingProfile)));
return services;
}
}
}