码迷,mamicode.com
首页 > 其他好文 > 详细

动态组合lambda 表达式

时间:2016-06-13 18:47:16      阅读:127      评论:0      收藏:0      [点我收藏+]

标签:

 //第三方审核记录实体集合—动态组合lambda 表达式
                    Expression<Func<ThirdAdEntity, bool>> thirdWhere =
                        p => p.Observer.Split(,).Contains(ortableEntity.CompanyAdtId.ToString()) &&
                             p.AdStartDate <= commonProperty.SystemDateTime &&
                             p.ThirdAdId != ortableEntity.ThirdAdId;
                    //质量管理检查记录 动态组合lambda 表达式
                    Expression<Func<QMSCheckEntity, bool>> checkWhere =
                        p => p.CheckGroupPerson.Split(,).Contains(ortableEntity.CompanyAdtId.ToString()) &&
                             p.CheckStartDate <= commonProperty.SystemDateTime;
                    //判断是否添加开始日期的校验
                    if (orTableWorking != null)
                    {
                        Expression<Func<ThirdAdEntity, bool>> starttWhere = p => p.AdStartDate >= orTableWorking.ParenORTable.ReportDate;
                        var invokedExpr = Expression.Invoke(starttWhere, thirdWhere.Parameters);
                        thirdWhere = Expression.Lambda<Func<ThirdAdEntity, bool>>
                            (Expression.And(thirdWhere.Body, invokedExpr), thirdWhere.Parameters);

                        Expression<Func<QMSCheckEntity, bool>> startcWhere = p => p.CheckStartDate >= orTableWorking.ParenORTable.ReportDate;
                        invokedExpr = Expression.Invoke(startcWhere, checkWhere.Parameters);
                        checkWhere = Expression.Lambda<Func<QMSCheckEntity, bool>>
                            (Expression.And(checkWhere.Body, invokedExpr), checkWhere.Parameters);
                        strOrTableWorking = orTableWorking.WorkingExperience + "\n";
                    }

 

动态组合lambda 表达式

标签:

原文地址:http://www.cnblogs.com/yisheng/p/5581387.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!