2
的问题是:如何修改表达式将它传递给一个方法
public GetAll(Expression<Func<CampModel, bool>> whereCondition)
{
// and it should call another GetAllCampsFromRepo method that gets Camps from a repository
}
public IList<Camp> GetAllCampsFromRepo(Expression<Func<Camp, bool>> whereCondition)
{
return // Blah blah the list of Camps
}
所以,问题是如何正确地从所述第一方法的主体调用第二方法中,不同类型的映射属性 - CampModel对象为Camp对象(它们类似但不同)
如何转换whereCondition
以便我可以将它传递给GetAllCampsFromRepo
?因为我不能把它当作是:
GetAllCampsFromRepo(whereCondition)
我可以使用类似System.Linq.Expressions.ExpressionVisitor和修改原始的表达?怎么做?
不错,谢谢!作品100% – Agzam