You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 4fc51ff
Browse filesBrowse the repository at this point in the historyBrowse files
Reads: sequential access is opt-in with SequentialAccess() (#269)
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>
/// Set on the definition, for every query made from it: the map, <see cref="SingleResult"/>, <see cref="CancelOnEarlyStop"/>, <see cref="AsyncReads"/>,
24
-
/// <see cref="UsePool(ArrayPool{T}, bool)"/> and (on the <see cref="DbQuery"/> before <c>Map</c>)
25
-
/// <see cref="DbQuery.SetTimeout(ushort)"/>. A query made from it can still apply <c>SingleResult</c>, <c>CancelOnEarlyStop</c>, <c>AsyncReads</c> and
26
-
/// <c>UsePool</c> for one call. Chosen per call: the parameters, <c>Skip</c> and <c>Take</c>.
24
+
/// <see cref="SequentialAccess"/>, <see cref="UsePool(ArrayPool{T}, bool)"/> and (on the <see cref="DbQuery"/> before <c>Map</c>)
25
+
/// <see cref="DbQuery.SetTimeout(ushort)"/>. A query made from it can still apply <c>SingleResult</c>, <c>CancelOnEarlyStop</c>, <c>AsyncReads</c>,
26
+
/// <c>SequentialAccess</c> and <c>UsePool</c> for one call. Chosen per call: the parameters, <c>Skip</c> and <c>Take</c>.
27
27
/// </para>
28
28
/// </remarks>
29
29
/// <typeparam name="T">The type each row is mapped to.</typeparam>
@@ -35,9 +35,10 @@ public sealed class MappedDbQuery<T>
Copy file name to clipboardExpand all lines: Source/Core/MappedQuery.cs
+36-23Lines changed: 36 additions & 23 deletions
Original file line number
Diff line number
Diff line change
@@ -148,6 +148,7 @@ public static MappedQuery<T> Map<T>(
148
148
/// <param name="singleResult"><see langword="true"/> to stop after the first result set and not read through the later ones; otherwise, <see langword="false"/>.</param>
149
149
/// <param name="asyncReads"><see langword="true"/> to read the rows of an asynchronous terminal with <c>ReadAsync</c>; otherwise, <see langword="false"/>, which reads them with <c>Read</c>.</param>
150
150
/// <param name="cancelOnEarlyStop"><see langword="true"/> to cancel the command when a terminal stops before the last row; otherwise, <see langword="false"/>.</param>
151
+
/// <param name="sequentialAccess"><see langword="true"/> to ask the reader for <see cref="CommandBehavior.SequentialAccess"/>; otherwise, <see langword="false"/>.</param>
151
152
/// <param name="config">The pool, the clear rule, the chunk sizes and the bin the pooling terminals use.</param>
0 commit comments