1

如何根据 linq to sql 中传递的字段将字段传递给其他函数以过滤数据 linq?

功能是

Private Function filter(Of T)(ByVal lnq As IQueryable(Of T), ByVal Field As Func(Of T, String)) As IQueryable(Of T)
   Return lnq.Where(Function(x) Field(x).ToLower.Equals("en")).AsQueryable
End Function

例子

dim lnq = from item in tbls
lnq = filter(of tbl)(lnq, Function(x) x.Culture)

运行代码错误:

Method 'System.String Invoke(System.Object[])' has no supported translation to SQL.
4

0 回答 0