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