Skip to content

Reads: sequential access is opt-in with SequentialAccess() - #269

Merged
electricessence merged 1 commit into
masterfrom
feat/sequential-access-opt-in
Dec 1, 2026
Merged

electricessence merged 1 commit into
masterfrom
feat/sequential-access-opt-in

Conversation

@electricessence

Copy link
Copy Markdown
Collaborator

The library reads every query with the default access mode. It no longer asks for CommandBehavior.SequentialAccess on its own: mapped reads (Map<T>(), AsObjectArrays(), AsDictionaryRows()), AnyAsync, CountAsync, LoadTable and LoadTables did, and ToDataTable and ToDataTables on an IDbCommand had it as the default of their behavior parameter, which is now CommandBehavior.Default.

New: SequentialAccess(), one fluent opt-in.

  • On a command it applies to every reader the command opens from then on: reader callbacks, the Map terminals and the DataTable terminals. It stays on the command, and the caller's own flags stay.
  • It is also on the mapped views (MappedCommand, MappedQuery and its Skip and Take forms) and the mapped definitions (MappedDbQuery).
  • There is no attribute and no per-model or generator setting.

Use it for very large text or binary values, above all one value copied as a stream with reader.GetStream. A selector given to Map must then read the columns in ascending order, or the provider throws. With AsyncReads() on a very large value, opt in: raw SqlClient with Default and ReadAsync took 48.0 s against 8.86 s for one 100 MB value; the library with default access was not measured.

Docs: the XML docs and a compiled sample show the streaming case; the benchmark and async-read pages say which figures were measured with sequential access; release note.

🤖 Generated with Claude Code

The library reads every query with the default access mode. It no longer asks for `CommandBehavior.SequentialAccess` on its own: mapped reads (`Map<T>()`, `AsObjectArrays()`, `AsDictionaryRows()`), `AnyAsync`, `CountAsync`, `LoadTable` and `LoadTables` did, and `ToDataTable` and `ToDataTables` on an `IDbCommand` had it as the default of their `behavior` parameter, which is now `CommandBehavior.Default`.

New: `SequentialAccess()`, one fluent opt-in.

- On a command it applies to every reader the command opens from then on: reader callbacks, the `Map` terminals and the `DataTable` terminals. It stays on the command, and the caller's own flags stay.
- It is also on the mapped views (`MappedCommand`, `MappedQuery` and its `Skip` and `Take` forms) and the mapped definitions (`MappedDbQuery`).
- There is no attribute and no per-model or generator setting.

Use it for very large text or binary values, above all one value copied as a stream with `reader.GetStream`. A selector given to `Map` must then read the columns in ascending order, or the provider throws. With `AsyncReads()` on a very large value, opt in: raw SqlClient with `Default` and `ReadAsync` took 48.0 s against 8.86 s for one 100 MB value; the library with default access was not measured.

Docs: the XML docs and a compiled sample show the streaming case; the benchmark and async-read pages say which figures were measured with sequential access; release note.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@electricessence
electricessence force-pushed the feat/sequential-access-opt-in branch from e608e86 to 8bc9754 Compare December 1, 2026 00:19
@electricessence
electricessence merged commit 4fc51ff into master Dec 1, 2026
10 checks passed
@electricessence
electricessence deleted the feat/sequential-access-opt-in branch December 1, 2026 00:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant