public static SimpleOperationTarget Build(Expression expression)
        {
            IFastCollection rootFastCollection        = null;
            var             operationTargetExpression = ExpressionNodeReplacer.ReplaceNode(expression, expr =>
            {
                if (expr != null &&
                    expr is FastCollectionReferenceExpression fastCollectionReferenceExpression)
                {
                    if (rootFastCollection != null)
                    {
                        throw new ArgumentException("Multiple fast collections were found in expression tree when build operation target.");
                    }
                    rootFastCollection = fastCollectionReferenceExpression.FastCollection;
                    return(expr);
                }

                return(null);
            });

            if (rootFastCollection == null)
            {
                throw new ArgumentException($"No {nameof(FastCollectionReferenceExpression)} were found in expression tree when build operation target.");
            }
            return(new SimpleOperationTarget(operationTargetExpression, rootFastCollection));
        }
 public FastCollectionLazyIterator(
     IFastCollection sourceCollection,
     SimpleOperationTarget operationTarget,
     Func <IEnumerable <FastCollectionItem <T> > > itemsBuilder)
 {
     _itemsBuilder    = itemsBuilder;
     OperationTarget  = operationTarget ?? throw new ArgumentNullException(nameof(operationTarget));
     SourceCollection = sourceCollection ?? throw new ArgumentNullException(nameof(sourceCollection));
 }
 internal FastCollectionIterator(
     [NotNull] IFastCollection sourceCollection,
     [NotNull] SimpleOperationTarget operationTarget,
     [NotNull] IEnumerable <FastCollectionItem <T> > itemsEnumerable)
 {
     SourceCollection = sourceCollection;
     OperationTarget  = operationTarget;
     ItemsEnumerable  = itemsEnumerable;
 }
        public static SimpleOperationTarget BuildForSelector <TSource, TResult>(
            [NotNull] IFastCollection <TSource> rootFastCollection,
            [NotNull] Expression <Func <TSource, TResult> > selector)
        {
            var normalSelector = new SelectorTransformer().TransformToNormalForm(selector);
            var t = LambdaParametersReplacer.ReplaceLambdaParameters((LambdaExpression)normalSelector, new FastCollectionReferenceExpression(rootFastCollection));

            return(new SimpleOperationTarget(t, rootFastCollection));
        }
예제 #5
0
 public FastCollectionItems(IFastCollection boundedFastCollection)
 {
     BoundedFastCollection = boundedFastCollection;
 }
예제 #6
0
 internal SimpleOperationTarget(Expression expression, [NotNull] IFastCollection rootFastCollection)
 {
     Expression         = expression;
     RootFastCollection = rootFastCollection ?? throw new ArgumentNullException(nameof(rootFastCollection));
 }
예제 #7
0
 public FastCollectionReferenceExpression(IFastCollection fastCollection)
 {
     FastCollection = fastCollection ?? throw new ArgumentNullException(nameof(fastCollection));
 }
예제 #8
0
 internal IndicesCoverage(IFastCollection boundedCollection)
 {
     BoundedCollection = boundedCollection ?? throw new ArgumentNullException(nameof(boundedCollection));
     _indicesCoverage  = new MultiValueDictionary <IOperationTarget, IIndex>();
 }
 public static SimpleOperationTarget BuildForRoot <TSource>(
     [NotNull] IFastCollection <TSource> rootFastCollection)
 {
     return(new SimpleOperationTarget(new FastCollectionReferenceExpression(rootFastCollection), rootFastCollection));
 }