use Expression> in Linq contains extension

后端 未结 3 1765
终归单人心
终归单人心 2020-12-16 04:17

Using the following example i would like to use my Expression inside my Contains method, having it pass the query onto sql server using the EF.

3条回答
  •  庸人自扰
    2020-12-16 05:05

    try Expression.Compile() method:

    return items.Where(item => validComps.Contains(resolveCompanyExpression.Compile()(item))).AsQueryable();
    

提交回复
热议问题