// <summary> // An asynchronous version of <see cref="CloseImplicitly" />, which // implicitly closes this (nested) data reader; will be called whenever // the user has done a GetValue() or a ReadAsync() on a parent reader/record // to ensure that we consume all our results. We do that because we // our design requires us to be positioned at the next nested reader's // first row. // </summary> internal async Task CloseImplicitlyAsync(CancellationToken cancellationToken) { await EnsureInitializedAsync(cancellationToken).WithCurrentCulture(); await ConsumeAsync(cancellationToken).WithCurrentCulture(); await _dataRecord.CloseImplicitlyAsync(cancellationToken).WithCurrentCulture(); }
/// <summary> /// An asynchronous version of <see cref="CloseImplicitly" />, which /// implicitly closes this (nested) data reader; will be called whenever /// the user has done a GetValue() or a ReadAsync() on a parent reader/record /// to ensure that we consume all our results. We do that because we /// our design requires us to be positioned at the next nested reader's /// first row. /// </summary> internal async Task CloseImplicitlyAsync(CancellationToken cancellationToken) { await EnsureInitializedAsync(cancellationToken).ConfigureAwait(continueOnCapturedContext: false); await ConsumeAsync(cancellationToken).ConfigureAwait(continueOnCapturedContext: false); await _dataRecord.CloseImplicitlyAsync(cancellationToken).ConfigureAwait(continueOnCapturedContext: false); }
private async Task CloseNestedObjectImplicitlyAsync(CancellationToken cancellationToken) { BridgeDataRecord currentNestedRecord = this._currentNestedRecord; if (currentNestedRecord != null) { this._currentNestedRecord = (BridgeDataRecord)null; await currentNestedRecord.CloseImplicitlyAsync(cancellationToken).WithCurrentCulture(); } BridgeDataReader currentNestedReader = this._currentNestedReader; if (currentNestedReader == null) { return; } this._currentNestedReader = (BridgeDataReader)null; await currentNestedReader.CloseImplicitlyAsync(cancellationToken).WithCurrentCulture(); }