protected override Expression VisitMember(MemberExpression memberExpression)
        {
            Check.NotNull(memberExpression, nameof(memberExpression));

            return
                (_queryModelVisitor.BindNavigationPathMemberExpression(
                     memberExpression,
                     (ps, qs) =>
            {
                var properties = ps.ToList();
                var navigations = properties.OfType <INavigation>().ToList();

                if (navigations.Any())
                {
                    var outerQuerySourceReferenceExpression = new QuerySourceReferenceExpression(qs);

                    var innerQuerySourceReferenceExpression
                        = CreateJoinsForNavigations(outerQuerySourceReferenceExpression, navigations);

                    return properties.Count == navigations.Count
                                    ? innerQuerySourceReferenceExpression
                                    : Expression.MakeMemberAccess(innerQuerySourceReferenceExpression, memberExpression.Member);
                }

                return default(Expression);
            })
                 ?? base.VisitMember(memberExpression));
        }
Esempio n. 2
0
                protected override Expression VisitMember(MemberExpression node)
                {
                    Check.NotNull(node, nameof(node));

                    return
                        (_queryModelVisitor.BindNavigationPathMemberExpression(
                             node,
                             (properties, querySource) =>
                    {
                        var navigations = properties.OfType <INavigation>().ToList();
                        var collectionNavigation = navigations.SingleOrDefault(n => n.IsCollection());

                        return collectionNavigation != null
                                        ? InjectSubquery(node, collectionNavigation)
                                        : default(Expression);
                    })
                         ?? base.VisitMember(node));
                }