码迷,mamicode.com
首页 > 移动开发 > 详细

表达式拼接Expression<Func<IEntityMapper, bool>> predicate

时间:2016-06-29 23:45:15      阅读:174      评论:0      收藏:0      [点我收藏+]

标签:

        /// <summary>
        /// 重写以筛选出当前上下文的实体映射信息
        /// </summary>
        protected override IEnumerable<IEntityMapper> EntityMappersFilter(IEnumerable<IEntityMapper> entityMappers)
        {
            Type contextType = typeof(TDbContext);
            Expression<Func<IEntityMapper, bool>> predicate = m => m.DbContextType == contextType;
            if (contextType == typeof(DefaultDbContext))
            {
                predicate = predicate.Or(m => m.DbContextType == null);
            }
            return entityMappers.Where(predicate.Compile());
        }

表达式拼接Expression<Func<IEntityMapper, bool>> predicate

标签:

原文地址:http://www.cnblogs.com/shiningrise/p/5628502.html

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