Beispiel #1
0
        protected override Expression VisitMemberExpression(MemberExpression memberExpression)
        {
            var newExpression = VisitExpression(memberExpression.Expression);

            if (newExpression != memberExpression.Expression)
            {
                if (newExpression.Type == typeof(IValueReader))
                {
                    return(_queryModelVisitor.BindMemberToValueReader(memberExpression, newExpression));
                }

                var member   = memberExpression.Member;
                var typeInfo = newExpression.Type.GetTypeInfo();

                if (typeInfo.IsGenericType &&
                    typeInfo.GetGenericTypeDefinition() == typeof(IAsyncGrouping <,>))
                {
                    member = typeInfo.GetDeclaredProperty("Key");
                }

                return(Expression.MakeMemberAccess(newExpression, member));
            }

            return(memberExpression);
        }