表达式目录树插件xLiAd.SqlEx.Core
表达式目录树使用时 引用xLiAd.SqlEx.Core ,是一个很好的插件
using xLiAd.SqlEx.Core.Helper;
Expression<Func<ReportedData, bool>> expression = p => p.CompanyId == companyId;
if (models.StartDate != null)
{
expression = expression.And(p => p.createTime > Convert.ToDateTime(models.StartDate));
}
if (models.EndDate != null)
{
expression = expression.And(p => p.createTime < Convert.ToDateTime(models.EndDate));
}