Пример #1
0
        public override EntityExpression IncludeMembers(EntityExpression entity, Func <MemberInfo, bool> fnIsIncluded)
        {
            var  assignments = this.GetAssignments(entity.Expression).ToDictionary(ma => ma.Member.Name);
            bool anyAdded    = false;

            foreach (var mi in this.mapping.GetMappedMembers(entity.Entity))
            {
                EntityAssignment ea;
                bool             okayToInclude = !assignments.TryGetValue(mi.Name, out ea) || IsNullRelationshipAssignment(entity.Entity, ea);
                if (okayToInclude && fnIsIncluded(mi))
                {
                    ea = new EntityAssignment(mi, this.GetMemberExpression(entity.Expression, entity.Entity, mi));
                    assignments[mi.Name] = ea;
                    anyAdded             = true;
                }
            }
            if (anyAdded)
            {
                return(new EntityExpression(entity.Entity, this.BuildEntityExpression(entity.Entity, assignments.Values.ToList())));
            }
            return(entity);
        }
Пример #2
0
 protected virtual Expression VisitEntity(EntityExpression entity)
 {
     this.Visit(entity.Expression);
     return(entity);
 }
Пример #3
0
 /// <summary>
 /// </summary>
 /// <returns></returns>
 public abstract bool HasIncludedMembers(EntityExpression entity);
Пример #4
0
 /// <summary>
 /// Recreate the type projection with the additional members included
 /// </summary>
 /// <param name="entity"></param>
 /// <param name="fnIsIncluded"></param>
 /// <returns></returns>
 public abstract EntityExpression IncludeMembers(EntityExpression entity, Func <MemberInfo, bool> fnIsIncluded);
Пример #5
0
 protected override Expression VisitEntity(EntityExpression entity)
 {
     return(this.Visit(entity.Expression));
 }
Пример #6
0
        protected virtual Expression VisitEntity(EntityExpression entity)
        {
            var exp = this.Visit(entity.Expression);

            return(this.UpdateEntity(entity, exp));
        }
Пример #7
0
 protected virtual bool CompareEntity(EntityExpression x, EntityExpression y)
 {
     return(x.Entity == y.Entity && this.Compare(x.Expression, y.Expression));
 }