private static SelectorLambdaOperatorDescriptor CreatePagingSelector(SortCollectionDescriptor sortDescriptor, Type modelType) => GetSelector ( modelType.GetIQueryableTypeString(), sortDescriptor, new ParameterOperatorDescriptor { ParameterName = queryParameterName } );
public static SelectorLambdaOperatorDescriptor CreatePagingSelector(SortCollectionDescriptor sortDescriptor, Type modelType, SearchFilterGroupDescriptor filterGroupDescriptor, string searchText) => string.IsNullOrEmpty(searchText) ? CreatePagingSelector(sortDescriptor, modelType) : GetSelector ( modelType.GetIQueryableTypeString(), sortDescriptor, CreateWhereBody(filterGroupDescriptor, searchText) );
private static OperatorDescriptorBase CreateSortBody(SortCollectionDescriptor sortCollectionDescriptor, OperatorDescriptorBase sourceOperand) { if (sortCollectionDescriptor?.SortDescriptions?.Any() != true) { throw new ArgumentException($"{nameof(sortCollectionDescriptor.SortDescriptions)}: C55F5642-5811-4840-B643-E38BDE7DA16E"); } return(sortCollectionDescriptor.SortDescriptions.Aggregate ( sourceOperand, (OperatorDescriptorBase descriptor, SortDescriptionDescriptor next) => { return object.ReferenceEquals(descriptor, sourceOperand) ? new OrderByOperatorDescriptor { SortDirection = next.SortDirection, SourceOperand = descriptor, SelectorBody = new MemberSelectorOperatorDescriptor { SourceOperand = new ParameterOperatorDescriptor { ParameterName = selectorParameterName }, MemberFullName = next.PropertyName }, SelectorParameterName = selectorParameterName } : new ThenByOperatorDescriptor { SortDirection = next.SortDirection, SourceOperand = descriptor, SelectorBody = new MemberSelectorOperatorDescriptor { SourceOperand = new ParameterOperatorDescriptor { ParameterName = selectorParameterName }, MemberFullName = next.PropertyName }, SelectorParameterName = selectorParameterName }; } )); }
public SelectorLambdaOperatorDescriptor CreatePagingSelector(SortCollectionDescriptor sortDescriptor, Type modelType, SearchFilterGroupDescriptor filterGroupDescriptor, string searchText) => CreatePagingSelectorHelper.CreatePagingSelector(sortDescriptor, modelType, filterGroupDescriptor, searchText);
private static SelectorLambdaOperatorDescriptor GetSelector(string queryableType, SortCollectionDescriptor sortDescriptor, OperatorDescriptorBase sourceOperand) => new SelectorLambdaOperatorDescriptor { Selector = CreatePagingDescriptor ( sortDescriptor, CreateSortBody ( sortDescriptor, sourceOperand ) ), ParameterName = queryParameterName, BodyType = queryableType, SourceElementType = queryableType };
private static OperatorDescriptorBase GetTakeOperator(this OperatorDescriptorBase pagingDescriptor, SortCollectionDescriptor sortCollectionDescriptor) => sortCollectionDescriptor.Take.HasValue ? new TakeOperatorDescriptor { SourceOperand = pagingDescriptor, Count = sortCollectionDescriptor.Take.Value } : pagingDescriptor;
private static OperatorDescriptorBase CreatePagingDescriptor(SortCollectionDescriptor sortCollectionDescriptor, OperatorDescriptorBase sortBody) => sortBody.GetSkipOperator(sortCollectionDescriptor).GetTakeOperator(sortCollectionDescriptor);