我正在编写一个实现关键词搜索的 LINQ 查询。换句话说,这个查询会返回那些包含关键字的
请参考以下内容:
到目前为止,一切都很顺利。但这只处理了您想在我的情况下匹配
相反地,假设我想基于“Description
Title
、Description
和 Id
的行。请参考以下内容:
public static IQueryable<EmployeeObject> QueryableSQL()
{
IQueryable<EmployeeObject> queryable = EmployeeRepository.GetAllEmployee();
}
public static IList<EmployeeObject> QLike(string txt)
{
IList<employeeObject> _emps = QueryableSQL().Where(x => x.Title == txt).ToList();
return _emps;
}
到目前为止,一切都很顺利。但这只处理了您想在我的情况下匹配
Title
的情况。相反地,假设我想基于“Description
或
Id进行搜索,我需要为Description创建一个新方法吗?还是有一种方法可以创建
Tree expression`?
.Where()
中使用它。 - gleng