如何创建Expression<Func<T, bool>>对象
我想写一个通用的查询条件方法,比如:caseAccounts=caseAccounts.Where(c=>c.ProjectName==“名称”);我想改写成caseAc...
我想写一个通用的查询条件方法,比如:
caseAccounts = caseAccounts.Where(c => c.ProjectName == “名称”);
我想改写成
caseAccounts = caseAccounts.Where(QueryService.EqualString<AccountView>(b => b.AccountNumber, "名称"));
调用方法:
public static Expression<Func<T, bool>> EqualString<T>(Expression<Func<T, string>> expression, string paramValue)
{
Expression<Func<T, bool>> result = null;
//这里要怎么写啊??
return result;
} 展开
caseAccounts = caseAccounts.Where(c => c.ProjectName == “名称”);
我想改写成
caseAccounts = caseAccounts.Where(QueryService.EqualString<AccountView>(b => b.AccountNumber, "名称"));
调用方法:
public static Expression<Func<T, bool>> EqualString<T>(Expression<Func<T, string>> expression, string paramValue)
{
Expression<Func<T, bool>> result = null;
//这里要怎么写啊??
return result;
} 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询