using AutoMapper;
UserModel user = Mapper.Map<UserManagerEntity , UserModel>(entity);
lambda表达式怎么映射呢?
@小兵程序:
public static Expression<Func<UserManagerEntity, bool>> GetEntityFunc(Expression<Func<UserModel, bool>> predicate) { var config = new MapperConfiguration(cfg => { cfg.CreateMap<UserManagerEntity, UserModel>(); }); var mapper = config.CreateMapper(); return mapper.Map< Expression <Func<UserModel, bool>> ,Expression <Func<UserManagerEntity, bool>>>(predicate); }
@Yu: 非常感谢!之前没有用过AutoMapper,学习了