学习博文:https://www.cnblogs.com/yan7/p/8085410.html

1.使用nuget 安装

  <PackageReference Include="AutoMapper" Version="8.0.0" />
<PackageReference Include="AutoMapper.Extensions.Microsoft.DependencyInjection" Version="6.0.0" />

 2.配置

  //添加自动映射
services.AddAutoMapper();
05-11 13:48