private VfpLimitExpression GetVfpLimitExpression(VfpLimitExpression limitExpression, VfpScanExpression scanExpression)
        {
            if (scanExpression == null)
            {
                return(null);
            }

            var keyMembers = GetKeyMembers(scanExpression.Target.ElementType.KeyMembers);

            if (!keyMembers.Any())
            {
                return(null);
            }

            var variableReference = new VfpVariableReferenceExpression(scanExpression.ResultType, GetUniqueVariableName());
            var expressionBinding = new VfpExpressionBinding(scanExpression, variableReference);
            var sortClauses       = GetSortClauses(keyMembers, expressionBinding).ToList().AsReadOnly();
            var sortExpression    = new VfpSortExpression(scanExpression.ResultType, expressionBinding, sortClauses);

            return(new VfpLimitExpression(limitExpression.ResultType,
                                          sortExpression,
                                          limitExpression.Limit,
                                          limitExpression.WithTies));
        }
示例#2
0
 public override VfpExpression Visit(VfpSortExpression expression)
 {
     // This method should not be called.  Sorting is handled in VisitSortClauses.
     throw new NotImplementedException();
 }
 public virtual VfpExpression Visit(VfpSortExpression expression)
 {
     return(new VfpSortExpression(expression.ResultType,
                                  VisitVfpExpressionBinding(expression.Input),
                                  CreateDbSortClauses(expression.SortOrder)));
 }