/// <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
最新推荐文章于 2020-09-08 16:21:27 发布