AutoMapper将实体对象映射到KeyValuePair的配置方法

public OrderMappingProfile()
{
//将实体映射到KeyValuePair键值对
CreateMap<tab_carPlan, KeyValuePair<int, string>>()
       .ConstructUsing(x => new KeyValuePair<int, string>(x.id, x.timeInterval));

}

配置如上

posted @ 2023-05-30 14:19  yuanyuanyang  阅读(8)  评论(0编辑  收藏  举报