Exemplo n.º 1
0
        public override void VisitColumnReference(ColumnReference columnReference)
        {
            var identifiers = columnReference.Identifiers;

            if (_lambdaParameters != null &&
                _lambdaParameters.Count > 0 &&
                _lambdaParameters.Peek().TryGetValue(identifiers.FirstOrDefault(), out var parameterExpression))
            {
                if (identifiers.Count > 1)
                {
                    AddExpressionToStack(MemberUtils.GetSubfieldMember(identifiers, 1, parameterExpression, _visitorMetadata.OperationsProvider));
                }
                else
                {
                    AddExpressionToStack(parameterExpression);
                }

                return;
            }

            identifiers = MemberUtils.RemoveAlias(_previousStage, identifiers);
            var memberAccess = MemberUtils.GetMember(_previousStage, identifiers, _visitorMetadata.OperationsProvider, out var property);

            AddUsedProperty(property);
            AddExpressionToStack(memberAccess);
            AddNameToStack(string.Join(".", identifiers));
        }