c# – AutoMapper 当字符串为空字符串时,自动赋值为null

CreateMap<string, string>().ConvertUsing(s => s == "" ? (string)null : s);

 

posted @ 2022-11-13 20:44  开拓丿飞  阅读(159)  评论(0编辑  收藏  举报