/// <summary>
 ///     Creates a buffer handling state needed by this coordinator.
 /// </summary>
 internal abstract Coordinator CreateCoordinator(Coordinator parent, Coordinator next);
示例#2
0
        internal Coordinator(CoordinatorFactory <T> coordinatorFactory, Coordinator parent, Coordinator next)
            : base(coordinatorFactory, parent, next)
        {
            TypedCoordinatorFactory = coordinatorFactory;

            // generate all children
            Coordinator nextChild = null;

            foreach (var nestedCoordinator in coordinatorFactory.NestedCoordinators.Reverse())
            {
                // last child processed is first child...
                Child     = nestedCoordinator.CreateCoordinator(this, nextChild);
                nextChild = Child;
            }

            IsUsingElementCollection = !IsRoot && (typeof(T) != typeof(RecordState));
        }
            private void MaterializeRow()
            {
                Coordinator currentCoordinator = _shaper.RootCoordinator;

                var depth = 0;
                var haveInitializedChildren = false;

                for (; depth < _current.Length; depth++)
                {
                    // find a coordinator at this depth that currently has data (if any)
                    while (currentCoordinator != null &&
                           !currentCoordinator.CoordinatorFactory.HasData(_shaper))
                    {
                        currentCoordinator = currentCoordinator.Next;
                    }
                    if (null == currentCoordinator)
                    {
                        break;
                    }

                    // check if this row contains a new element for this coordinator
                    if (currentCoordinator.HasNextElement(_shaper))
                    {
                        // if we have children and haven't initialized them yet, do so now
                        if (!haveInitializedChildren &&
                            null != currentCoordinator.Child)
                        {
                            currentCoordinator.Child.ResetCollection(_shaper);
                        }
                        haveInitializedChildren = true;

                        // read the next element
                        currentCoordinator.ReadNextElement(_shaper);

                        // Z.EntityFramework.Classic: QueryResultFilter
                        if (currentCoordinator.CurrentWrapper is FilterRemovedEntityWrapper)
                        {
                            depth--;
                        }
                        else
                        {
                            // place the coordinator in the result array to indicate there is a new
                            // element at this depth
                            _current[depth] = currentCoordinator;
                        }
                    }
                    else
                    {
                        // clear out the coordinator in result array to indicate there is no new
                        // element at this depth
                        _current[depth] = null;
                    }

                    // move to child (in the next iteration we deal with depth + 1
                    currentCoordinator = currentCoordinator.Child;
                }

                // clear out all positions below the depth we reached before we ran out of data
                for (; depth < _current.Length; depth++)
                {
                    _current[depth] = null;
                }
            }
示例#4
0
 // <summary>
 // Creates a buffer handling state needed by this coordinator.
 // </summary>
 internal abstract Coordinator CreateCoordinator(Coordinator parent, Coordinator next);
 protected Coordinator(CoordinatorFactory coordinatorFactory, Coordinator parent, Coordinator next)
 {
     CoordinatorFactory = coordinatorFactory;
     Parent             = parent;
     Next = next;
 }