Пример #1
0
 public SortOperationInvocation(
     SortOperationKind kind,
     PropertyInfo property)
 {
     Kind     = kind;
     Property = property
                ?? throw new ArgumentNullException(nameof(property));
 }
 public static SortOperationInvocation CreateSortOperation(
     this QueryableSortVisitorContext context,
     SortOperationKind kind)
 {
     if (context.InMemory)
     {
         return(context.Closure.CreateInMemorySortOperation(kind));
     }
     return(context.Closure.CreateSortOperation(kind));
 }
 public SortOperationInvocation(
     SortOperationKind kind,
     ParameterExpression parameterExpression,
     Expression expressionBody
     )
 {
     Kind      = kind;
     Parameter = parameterExpression
                 ?? throw new ArgumentNullException(nameof(parameterExpression));
     ExpressionBody = expressionBody
                      ?? throw new ArgumentNullException(nameof(expressionBody));
 }
        public SortOperationInvocation CreateInMemorySortOperation(
            SortOperationKind kind)
        {
            Expression nextExpression = Instance.Peek();

            if (Property.Count > 0)
            {
                DefaultExpression defaultOfType =
                    Expression.Default(Property.Peek().PropertyType);
                Stack <Expression> .Enumerator enumerator = Instance.GetEnumerator();
                enumerator.MoveNext();
                while (enumerator.MoveNext())
                {
                    nextExpression =
                        SortExpressionBuilder.IfNullThenDefault(
                            enumerator.Current, nextExpression, defaultOfType);
                }
            }
            return(new SortOperationInvocation(kind, Parameter, nextExpression));
        }
Пример #5
0
 public SortOperationInvocation CreateSortOperation(SortOperationKind kind)
 {
     return(new SortOperationInvocation(
                kind, Parameter, Instance.Peek(), Property.Peek().PropertyType));
 }
 protected override SortOperationInvocation CreateSortOperation(
     SortOperationKind kind)
 {
     return(Closure.CreateInMemorySortOperation(kind));
 }
 protected virtual SortOperationInvocation CreateSortOperation(SortOperationKind kind)
 {
     return(Closure.CreateSortOperation(kind));
 }