internal Shaper(
            DbDataReader reader, ObjectContext context, MetadataWorkspace workspace, MergeOption mergeOption,
            int stateCount, CoordinatorFactory <T> rootCoordinatorFactory, bool readerOwned, bool streaming)
            : base(reader, context, workspace, mergeOption, stateCount, streaming)
        {
            DebugCheck.NotNull(rootCoordinatorFactory);

            RootCoordinator = (Coordinator <T>)rootCoordinatorFactory.CreateCoordinator(parent: null, next: null);
            _isObjectQuery  = !(typeof(T) == typeof(RecordState));
            _isActive       = true;
            RootCoordinator.Initialize(this);
            _readerOwned = readerOwned;
        }
            public bool MoveNext()
            {
                try
                {
                    _shaper.StartMaterializingElement();

                    if (!_shaper.StoreRead())
                    {
                        // Reset all collections
                        RootCoordinator.ResetCollection(_shaper);
                        return(false);
                    }

                    MaterializeRow();
                }
                finally
                {
                    _shaper.StopMaterializingElement();
                }

                return(true);
            }
            public async Task <bool> MoveNextAsync(CancellationToken cancellationToken)
            {
                try
                {
                    _shaper.StartMaterializingElement();

                    if (!await _shaper.StoreReadAsync(cancellationToken).ConfigureAwait(continueOnCapturedContext: false))
                    {
                        // Reset all collections
                        RootCoordinator.ResetCollection(_shaper);
                        return(false);
                    }

                    MaterializeRow();
                }
                finally
                {
                    _shaper.StopMaterializingElement();
                }

                return(true);
            }
Exemplo n.º 4
0
            public async Task <bool> MoveNextAsync(CancellationToken cancellationToken)
            {
                try
                {
                    _shaper.StartMaterializingElement();

                    if (!await _shaper.StoreReadAsync(cancellationToken).WithCurrentCulture())
                    {
                        // Reset all collections
                        RootCoordinator.ResetCollection(_shaper);
                        return(false);
                    }

                    MaterializeRow();
                }
                finally
                {
                    _shaper.StopMaterializingElement();
                }

                return(true);
            }