/// <summary> /// 增加auto mapper自动化映射,注册了全局单例IMapper /// </summary> /// <param name="kernelService"></param> /// <returns></returns> public static IKernelServices AddAutoMapperByConvention(this IKernelServices kernelService) { var assemblies = ReflectionHelper.GetReferredAssemblies(typeof(AutoMapperExtensions).Assembly, DependencyContext.Default); return(kernelService.AddAutoMapperByConvention(assemblies)); }
public void Configure(IKernelServices kernelService) { if (!Options.Value.Enable) { return; } kernelService.AddAutoMapperByConvention(); }