CreateMap<Application, ApplicationDto>()
.ForMember(dest => dest.Enabled, opt => opt.MapFrom(s => s.Enabled == true ? "已启用" : "未启用"))
.ForMember(dest => dest.RegisterEnabled, opt => opt.MapFrom(s => s.RegisterEnabled == true ? "已启用注册" : "未启用注册"))
.ReverseMap();
CreateMap<ApplicationDto, Application>().ForMember(dest => dest.Enabled, opt => opt.MapFrom(s => s.Enabled == "已启用" ? true : false))
.ForMember(dest => dest.RegisterEnabled, opt => opt.MapFrom(s => s.RegisterEnabled == "已启用注册" ? true : false))
.ReverseMap();
类型间的相互转换
来自:https://www.cnblogs.com/Anthony518/p/11038392.html