Exemplo n.º 1
0
        public virtual bool MoveNext()
        {
            switch (state)
            {
            case 0:
                goto state0;

            case 1:
                goto state1;

            case 9:
                goto state9;
            }
state0:

            this.state = 1;
            var commandsContext = this.transactionExecutionContextAcquisition.TransactionContext.GetSqlTransactionalCommandsContext();

            this.dataReader = commandsContext.ExecuteReader(this.objectProjector.formatResult.CommandText, this.objectProjector.formatResult.ParameterValues);
            this.context    = objectProjector.CreateEnumerationContext(this.dataReader, this.transactionExecutionContextAcquisition.Version);

state1:
            T result;

            if (this.dataReader.ReadEx())
            {
                T value = this.objectProjector.objectReader(this.objectProjector, this.dataReader, this.transactionExecutionContextAcquisition.Version, this.objectProjector.placeholderValues, o => objectProjector.ProcessDataAccessObject(o, ref context));

                if (this.objectProjector.ProcessMoveNext(this.dataReader, value, ref this.context, out result))
                {
                    this.Current = result;

                    return(true);
                }

                goto state1;
            }

            this.state = 9;

            if (this.objectProjector.ProcessLastMoveNext(this.dataReader, ref this.context, out result))
            {
                this.Current = result;

                return(true);
            }

state9:

            return(false);
        }
        public virtual bool MoveNext()
        {
            switch (state)
            {
            case 0:
                goto state0;

            case 1:
                goto state1;

            case 9:
                goto state9;
            }
state0:

            this.state      = 1;
            this.dataReader = this.acquisition.SqlDatabaseCommandsContext.ExecuteReader(this.objectProjector.formatResult.CommandText, this.objectProjector.formatResult.ParameterValues);
            this.context    = objectProjector.CreateEnumerationContext(this.dataReader, this.versionContext.Version);

state1:
            T result;

            if (this.dataReader.ReadEx())
            {
                T value = this.objectProjector.objectReader(this.objectProjector, this.dataReader, this.versionContext.Version, this.objectProjector.placeholderValues);

                if (this.objectProjector.ProcessMoveNext(value, ref this.context, out result))
                {
                    this.Current = result;

                    return(true);
                }

                goto state1;
            }

            this.state = 9;

            if (this.objectProjector.ProcessLastMoveNext(ref this.context, out result))
            {
                this.Current = result;

                return(true);
            }

state9:

            return(false);
        }