2011-07-14 52 views
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和修改原始的表达?怎么做?

回答

相关问题