Repository navigation
The buffered Results family and FirstOrdinalResults return the Queue<T> they build - #109
Closed
electricessence wants to merge 5 commits into
Closed
electricessence wants to merge 5 commits into
electricessence wants to merge 5 commits into
Conversation
…T> they build, holding null instead of DBNull, instead of a one-shot dequeuing enumerable. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…object forms hold null, and that a bad cast in the non-provider FirstOrdinalResults<T> throws at the call. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…g a queue that can be enumerated again and dequeued. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…compatibility changes and the cast-failure change listed. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
If you generate a queue, let the caller use it.
ResultsBuffered,Results<T>(IDbCommand),ResultsAsync<T>(DbCommand)andFirstOrdinalResults*used to wrap the queue they built in a one-shotDequeueEach()enumerable. They now return the queue.What changes
24 public members change their return type:
IEnumerable<X>becomesQueue<X>, andValueTask<IEnumerable<X>>becomesValueTask<Queue<X>>. Parameters, defaults and attributes are unchanged.CoreExtensions:ResultsBuffered<T>(2),Results<T>(IDbCommand)(2),ResultsBufferedAsync<T>(3),ResultsAsync<T>(DbCommand)(3).DataReaderExtensions,CommandExtensions,IExecuteReaderExtensionsandExpressiveDbCommandBase: theFirstOrdinalResultsandFirstOrdinalResultsAsyncforms, with and withoutT0(14).PublicAPI.Unshipped.txt: 24*REMOVED*lines and 24 new lines.Behaviour changes:
Countis the number of rows read.First()andTake()no longer discard what they read.Dequeue(orTryDequeue) to release them as you go.FirstOrdinalResults()) hold null, neverDBNull. The conversion happens while the queue is built; nothing is left to do lazily.FirstOrdinalResults<T0>path (a reader or command that is not aDbDataReaderorDbCommand), a value that cannot be cast toT0throws from the call, not while you enumerate. The provider path already did.var x = command.Results<T>(); x = x.Where(...),ValueTask<IEnumerable<T>> v = command.ResultsAsync<T>()on aDbCommandor reader, and.AsTask()assigned toTask<IEnumerable<T>>.The members marked
[Obsolete]in #107 (IExecuteReader.Results<T>,ExpressiveDbCommand.ResultsAsync<T>x2) keep theirIEnumerable<T>return type. They now return the replayable queue typed asIEnumerable<T>; the two async ones need a one-line body change.DequeueEachstays public and is no longer used inside the library.Docs
whats-new-11.md: item 14 rewritten, and a new section "The buffered results are a queue" with the source-compatibility list and the cast-failure note.foundation.md: the buffering sentence now says the rows are read and mapped first and returned as aQueue<T>.Benchmarks/RESULTS.md: "draining queue" reworded; the 2026-11-07 re-measurement is marked "before rc.4". No benchmark was run.docsite/samples/BufferedQueue.cs(two regions) with three checks inProgram.cs.<returns>says what is returned (replay,Dequeue, lifetime), and the summaries no longer say the transform is applied per iteration.Tests
BufferedQueueTests: a reflection test over the 24 members, replay andCount,Dequeue, null notDBNullon every receiver, async withuseReadAsynctrue and false, a cancelled token, the eager cast failure, and the obsolete-boundIExecuteReader.Results<T>still returning its rows.ResultsBuffered_DrainsAsItIsEnumeratedis replaced byResultsBuffered_ReturnsTheQueue_AndEnumeratingDoesNotEmptyIt. Two edge tests assert the queue type, the count and a second pass.ExpressiveDbCommandinstance test forFirstOrdinalResultsAsync; it is covered by the reflection test and the existing leak tests.Checks
From the gate (
verify-gate.ps1) on the committed tree:distinct warning lines: 0).That gate ran before master's #108 was merged into this branch. #108 touches no file this change touches, and the merge had no conflicts. A gate run on the merged tree is next; this PR stays a draft until it and an independent review pass.
Not in this change
The version bump and the "Changes since rc.3" note for rc.4. Removal or deprecation of
DequeueEach. No benchmark or allocation numbers.🤖 Generated with Claude Code