有两个类:public class User{public int Id { get; set; }public string Name { get; set; }}public class UserDto{public int Id { get; set; }}如何将:Expression<Func<UserDto, bool>> exp = item => item.Id.Equals(0); 转换成Expression<Func<User, bool>>
1 回答
慕森王
TA贡献1777条经验 获得超3个赞
转换不了的,还是用接口实际点
public interface IUser{ int Id{ get ; set ;} } public class User:IUser { public int Id { get ; set ; } public string Name { get ; set ; } } public class UserDto:IUser { public int Id { get ; set ; } } |
Expression<Func<IUser, bool >> exp = item => item.Id.Equals(0); |
- 1 回答
- 0 关注
- 276 浏览
添加回答
举报
0/150
提交
取消