zoukankan      html  css  js  c++  java
  • AutoMapper bool与string互转

    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();

  • 相关阅读:
    杭电2081
    杭电2083
    杭电2084
    3/5/2014 cfb 小心
    116
    uva10003
    10815
    127
    674
    uva 13598
  • 原文地址:https://www.cnblogs.com/Anthony518/p/11038392.html
Copyright © 2011-2022 走看看