Automapper映射异常之注册
1.映射报错

原因:
需要在startup.cs中添加Automapper映射
点击查看代码
builder.Services.AddAutoMapper(typeof(AutoMapperConfigs));
AutoMapperConfigs类需要继承profile
点击查看代码
/// <summary>
/// Dto的映射配置
/// </summary>
public class AutoMapperConfigs: Profile
{
public AutoMapperConfigs()
{
//用户
CreateMap<User, UserRes>();
}
}

浙公网安备 33010602011771号