NewGaoKaoApi/New_College.Extensions/ServiceExtensions/AutoMapperSetup.cs

22 lines
569 B
C#

using AutoMapper;
using New_College.AutoMapper;
using Microsoft.Extensions.DependencyInjection;
using System;
namespace New_College.Extensions
{
/// <summary>
/// Automapper 启动服务
/// </summary>
public static class AutoMapperSetup
{
public static void AddAutoMapperSetup(this IServiceCollection services)
{
if (services == null) throw new ArgumentNullException(nameof(services));
services.AddAutoMapper(typeof(AutoMapperConfig));
AutoMapperConfig.RegisterMappings();
}
}
}