2
我想我的抽象電話IQueryable
,這樣我可以通過這裏進入功能:如何將右側「where」傳遞給c#中的IQueryable實例化?
喜歡的東西:
public IQueryable<T> executeQuery<T>(T baseType, Expression<Func<T,object>> whereFunc) where T : class
{
//Get context
DataContext dbContext = new DataContext(connection);
//Get the table representation
Table<T> baseTable = dbContext.GetTable<T>();
//Get our query object
IQueryable<T> baseQuery = from item in baseTable where whereFunc select item;
}
以上不工作,但有一些方法來做到這一點? (即一般創建IQueryable,但允許傳入where子句?)