private void SetShaper(Shaper <RecordState> shaper, CoordinatorFactory <RecordState> coordinatorFactory, int depth) { Shaper = shaper; CoordinatorFactory = coordinatorFactory; DataRecord = new BridgeDataRecord(shaper, depth); // To determine whether there are any rows for this coordinator at this place in // the root enumerator, we pretty much just look at it's current record (we'll read // one if there isn't one waiting) and if it matches our coordinator, we've got rows. _hasRows = false; if (!Shaper.DataWaiting) { Shaper.DataWaiting = Shaper.RootEnumerator.MoveNext(); } if (Shaper.DataWaiting) { RecordState currentRecord = Shaper.RootEnumerator.Current; if (null != currentRecord) { _hasRows = (currentRecord.CoordinatorFactory == CoordinatorFactory); } } // Once we've created the root enumerator, we can get the default record state DefaultRecordState = coordinatorFactory.GetDefaultRecordState(Shaper); Debug.Assert(null != DefaultRecordState, "no default?"); }
protected Coordinator( CoordinatorFactory coordinatorFactory, Coordinator parent, Coordinator next) { this.CoordinatorFactory = coordinatorFactory; this.Parent = parent; this.Next = next; }
/// <summary> /// Constructor used by the ResultColumn when doing GetValue, and by the Create factory /// method. /// </summary> /// <param name="collection"></param> /// <param name="isRoot"></param> /// <param name="nextResultShaperInfos">enumrator of the shapers for NextResult() calls</param> internal BridgeDataReader(Shaper <RecordState> shaper, CoordinatorFactory <RecordState> coordinatorFactory, int depth, IEnumerator <KeyValuePair <Shaper <RecordState>, CoordinatorFactory <RecordState> > > nextResultShaperInfos) : base() { Debug.Assert(null != shaper, "null shaper?"); Debug.Assert(null != coordinatorFactory, "null coordinatorFactory?"); Debug.Assert(depth == 0 || nextResultShaperInfos == null, "Nested data readers should not have multiple result sets."); NextResultShaperInfoEnumerator = nextResultShaperInfos != null ? nextResultShaperInfos : null; SetShaper(shaper, coordinatorFactory, depth); }
internal BridgeDataReader( Shaper <RecordState> shaper, CoordinatorFactory <RecordState> coordinatorFactory, int depth, IEnumerator <KeyValuePair <Shaper <RecordState>, CoordinatorFactory <RecordState> > > nextResultShaperInfos) { BridgeDataReader bridgeDataReader = this; this._nextResultShaperInfoEnumerator = nextResultShaperInfos; this._initialize = (Action)(() => bridgeDataReader.SetShaper(shaper, coordinatorFactory, depth)); this._initializeAsync = (Func <CancellationToken, Task>)(ct => bridgeDataReader.SetShaperAsync(shaper, coordinatorFactory, depth, ct)); }
private void SetShaper(Shaper <RecordState> shaper, CoordinatorFactory <RecordState> coordinatorFactory, int depth) { _shaper = shaper; _coordinatorFactory = coordinatorFactory; _dataRecord = new BridgeDataRecord(shaper, depth); if (!_shaper.DataWaiting) { _shaper.DataWaiting = _shaper.RootEnumerator.MoveNext(); } InitializeHasRows(); }
private async Task SetShaperAsync( Shaper <RecordState> shaper, CoordinatorFactory <RecordState> coordinatorFactory, int depth, CancellationToken cancellationToken) { this._shaper = shaper; this._coordinatorFactory = coordinatorFactory; this._dataRecord = new BridgeDataRecord(shaper, depth); if (!this._shaper.DataWaiting) { this._shaper.DataWaiting = (await this._shaper.RootEnumerator.MoveNextAsync(cancellationToken).WithCurrentCulture <bool>() ? 1 : 0) != 0; } this.InitializeHasRows(); }
internal BridgeDataReader( Shaper <RecordState> shaper, CoordinatorFactory <RecordState> coordinatorFactory, int depth, IEnumerator <KeyValuePair <Shaper <RecordState>, CoordinatorFactory <RecordState> > > nextResultShaperInfos) { DebugCheck.NotNull(shaper); DebugCheck.NotNull(coordinatorFactory); Debug.Assert(depth == 0 || nextResultShaperInfos == null, "Nested data readers should not have multiple result sets."); _nextResultShaperInfoEnumerator = nextResultShaperInfos; _initialize = () => SetShaper(shaper, coordinatorFactory, depth); #if !NET40 _initializeAsync = ct => SetShaperAsync(shaper, coordinatorFactory, depth, ct); #endif }
private async Task SetShaperAsync( Shaper <RecordState> shaper, CoordinatorFactory <RecordState> coordinatorFactory, int depth, CancellationToken cancellationToken) { _shaper = shaper; _coordinatorFactory = coordinatorFactory; _dataRecord = new BridgeDataRecord(shaper, depth); if (!_shaper.DataWaiting) { _shaper.DataWaiting = await _shaper.RootEnumerator.MoveNextAsync(cancellationToken).ConfigureAwait(continueOnCapturedContext: false); } InitializeHasRows(); }
private async Task SetShaperAsync( Shaper <RecordState> shaper, CoordinatorFactory <RecordState> coordinatorFactory, int depth, CancellationToken cancellationToken) { _shaper = shaper; _coordinatorFactory = coordinatorFactory; _dataRecord = new BridgeDataRecord(shaper, depth); if (!_shaper.DataWaiting) { _shaper.DataWaiting = await _shaper.RootEnumerator.MoveNextAsync(cancellationToken).WithCurrentCulture(); } InitializeHasRows(); }
protected Coordinator(CoordinatorFactory coordinatorFactory, Coordinator parent, Coordinator next) { CoordinatorFactory = coordinatorFactory; Parent = parent; Next = next; }