我有一个用户控件,它接受一个Func,然后将其提供给IQueryable的Linq "Where“扩展方法。其想法是,从调用代码中,我可以传入所需的搜索函数。我想像这样动态构建这个搜索函数:if (txtName.Text.Length > 0) {
//add it to the这种方法的问题是,由于
我有:var a = SomeEntity.Where(f => dict[f.key].Contains(f.someValue)) LINQ to Entities does not recognize the method 'System.Collections.Generic.List`1[System.Int32] get_Item(Int32)' method
而在处理列表时,它是有效的
我有一个生成表达式的函数,用于linqWhere子句中。public static Expression<Func<T,bool>> GetWhereCondition<T>() where T : IActive return x => x.Active;(注意IActive只定义了属性'Active')
还有其他相关的函数,我的想法