Skip to content

Commit 4fc51ff

Browse 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>
1 parent 19369e4 commit 4fc51ff

30 files changed

Lines changed: 436 additions & 87 deletions

‎Source/Core/Core/RowsSources.cs‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@ namespace Open.Database.Extensions.Core;
33
/// <summary>
44
/// Reads a row without a model: one slot for each column, <see cref="DBNull"/> read as <see langword="null"/>.
55
/// </summary>
6-
// GetValues reads each column once, in order, so a provider may stream the row
7-
// (the read mode of a generated mapping applies: SequentialAccess).
6+
// GetValues reads each column once, in order, so it also works with SequentialAccess().
87
static class ObjectRow
98
{
109
/// <summary>Reads the current row of a record.</summary>

‎Source/Core/ExpressiveCommandBase.cs‎

Lines changed: 41 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ private protected sealed class CommandOptions
100100
public CancellationToken CancellationToken;
101101
public ushort Timeout = CommandTimeout.DEFAULT_SECONDS;
102102
public bool AsyncReads;
103+
public bool SequentialAccess;
103104
}
104105

105106
private protected CommandOptions? _options;
@@ -741,6 +742,44 @@ public TThis SetTimeout(ushort seconds)
741742
return (TThis)this;
742743
}
743744

745+
/// <summary>Opens this command's readers with <see cref="CommandBehavior.SequentialAccess"/>, for very large text or binary values.</summary>
746+
/// <remarks>
747+
/// <para>
748+
/// The provider then streams each row instead of buffering it, and a column can be read once, in ascending order.
749+
/// It applies to every reader this command opens from then on: a reader callback, the <c>Map</c> terminals (also of a view made before this call)
750+
/// and the <see cref="DataTable"/> terminals. It stays on the command.
751+
/// Without it the library reads with the default access mode.
752+
/// </para>
753+
/// <para>
754+
/// The typical use is to copy one very large value as a stream: select the key columns first and the large column last,
755+
/// and read it in a reader callback with <see cref="DbDataReader.GetStream(int)"/>.
756+
/// A selector given to <c>Map</c> must read the columns in ascending order, or the provider throws.
757+
/// </para>
758+
/// </remarks>
759+
/// <example>
760+
/// Copy one large value from a command made on a <see cref="DbConnection"/> or a factory:
761+
/// <code>
762+
/// await command
763+
/// .SequentialAccess()
764+
/// .ExecuteReaderAsync(async ValueTask (reader) =>
765+
/// {
766+
/// if (!await reader.ReadAsync(cancellationToken)) return;
767+
/// using Stream value = reader.GetStream(0);
768+
/// await value.CopyToAsync(destination, cancellationToken);
769+
/// }, cancellationToken: cancellationToken);
770+
/// </code>
771+
/// </example>
772+
/// <returns>This instance for use in method chaining.</returns>
773+
public TThis SequentialAccess()
774+
{
775+
EnsureOptions().SequentialAccess = true;
776+
return (TThis)this;
777+
}
778+
779+
// The behavior a reader of this command is asked for: the caller's, and sequential access when SequentialAccess() was called.
780+
CommandBehavior WithAccess(CommandBehavior behavior)
781+
=> _options is { SequentialAccess: true } ? behavior | CommandBehavior.SequentialAccess : behavior;
782+
744783
#region Derived parameter names
745784

746785
/// <summary>
@@ -1395,7 +1434,7 @@ internal TResult ExecuteReader<TState, TResult>(TState state, Func<IDataReader,
13951434
if (transform is null) throw new ArgumentNullException(nameof(transform));
13961435
Contract.EndContractBlock();
13971436

1398-
return ExecuteCore((state, transform, behavior), static (cmd, prior, s) =>
1437+
return ExecuteCore((state, transform, behavior: WithAccess(behavior)), static (cmd, prior, s) =>
13991438
{
14001439
ReaderAbandon.ArmFor(s.transform, cmd);
14011440
CommandBehavior b = ConnectionExtensions.ReaderBehavior(prior, s.behavior);
@@ -1498,7 +1537,7 @@ ValueTask<T> IExecuteReader<TReader>.ExecuteReaderAsync<T>(
14981537
=> ExecuteReaderAsync(handler, behavior, default);
14991538

15001539
ValueTask<TResult> ExecuteReaderCoreAsync<TState, TResult>(TState state, Func<IDataReader, TState, ValueTask<TResult>> transform, CommandBehavior behavior, CancellationToken cancellationToken)
1501-
=> ExecuteCoreAsync((state, transform, behavior, cancellationToken), static async (cmd, prior, s) =>
1540+
=> ExecuteCoreAsync((state, transform, behavior: WithAccess(behavior), cancellationToken), static async (cmd, prior, s) =>
15021541
{
15031542
ReaderAbandon.ArmFor(s.transform, cmd);
15041543
CommandBehavior b = ConnectionExtensions.ReaderBehavior(prior, s.behavior);

‎Source/Core/MappedDbQuery.cs‎

Lines changed: 25 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ namespace Open.Database.Extensions;
2121
/// </para>
2222
/// <para>
2323
/// 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>.
2727
/// </para>
2828
/// </remarks>
2929
/// <typeparam name="T">The type each row is mapped to.</typeparam>
@@ -35,9 +35,10 @@ public sealed class MappedDbQuery<T>
3535
readonly ArrayPool<T>? _pool;
3636
readonly bool _clearOnReturn;
3737
readonly bool _cancelOnEarlyStop;
38+
readonly bool _sequentialAccess;
3839

3940
internal MappedDbQuery(DbQuery definition, IRowSource<T> source)
40-
: this(definition, source, false, false, null, false, false)
41+
: this(definition, source, false, false, null, false, false, false)
4142
{
4243
}
4344

@@ -48,7 +49,8 @@ internal MappedDbQuery(DbQuery definition, IRowSource<T> source)
4849
bool asyncReads,
4950
ArrayPool<T>? pool,
5051
bool clearOnReturn,
51-
bool cancelOnEarlyStop)
52+
bool cancelOnEarlyStop,
53+
bool sequentialAccess)
5254
{
5355
Debug.Assert(definition is not null);
5456
Debug.Assert(source is not null);
@@ -60,6 +62,7 @@ internal MappedDbQuery(DbQuery definition, IRowSource<T> source)
6062
_pool = pool;
6163
_clearOnReturn = clearOnReturn;
6264
_cancelOnEarlyStop = cancelOnEarlyStop;
65+
_sequentialAccess = sequentialAccess;
6366
}
6467

6568
/// <summary>Gets the command definition under this mapped one.</summary>
@@ -72,23 +75,31 @@ internal MappedDbQuery(DbQuery definition, IRowSource<T> source)
7275
/// <returns>A definition that reads only the first result set.</returns>
7376

7477
public MappedDbQuery<T> SingleResult()
75-
=> new(Query, _source, true, _asyncReads, _pool, _clearOnReturn, _cancelOnEarlyStop);
78+
=> new(Query, _source, true, _asyncReads, _pool, _clearOnReturn, _cancelOnEarlyStop, _sequentialAccess);
7679

7780
/// <summary>
7881
/// Cancels the command when a terminal stops before the last row, in every query made from this definition
7982
/// (see <see cref="MappedQuery{T}.CancelOnEarlyStop"/> for when to use it and what it costs).
8083
/// </summary>
8184
/// <returns>A definition whose queries cancel their command on an early stop.</returns>
8285
public MappedDbQuery<T> CancelOnEarlyStop()
83-
=> new(Query, _source, _singleResult, _asyncReads, _pool, _clearOnReturn, true);
86+
=> new(Query, _source, _singleResult, _asyncReads, _pool, _clearOnReturn, true, _sequentialAccess);
8487

8588
/// <summary>
8689
/// Reads the rows with the asynchronous read of the provider, in every query made from this definition
8790
/// (see <see cref="MappedQuery{T}.AsyncReads"/>).
8891
/// </summary>
8992
/// <returns>A definition that reads asynchronously.</returns>
9093
public MappedDbQuery<T> AsyncReads()
91-
=> new(Query, _source, _singleResult, true, _pool, _clearOnReturn, _cancelOnEarlyStop);
94+
=> new(Query, _source, _singleResult, true, _pool, _clearOnReturn, _cancelOnEarlyStop, _sequentialAccess);
95+
96+
/// <summary>
97+
/// Asks the reader for sequential access, in every query made from this definition
98+
/// (see <see cref="MappedQuery{T}.SequentialAccess"/> for when to use it).
99+
/// </summary>
100+
/// <returns>A definition whose queries read with sequential access.</returns>
101+
public MappedDbQuery<T> SequentialAccess()
102+
=> new(Query, _source, _singleResult, _asyncReads, _pool, _clearOnReturn, _cancelOnEarlyStop, true);
92103

93104
/// <summary>
94105
/// Takes the arrays that hold the rows from <paramref name="pool"/>, in every query made from this definition
@@ -103,7 +114,7 @@ public MappedDbQuery<T> UsePool(ArrayPool<T> pool, bool clearOnReturn)
103114
if (pool is null) throw new ArgumentNullException(nameof(pool));
104115
Contract.EndContractBlock();
105116

106-
return new(Query, _source, _singleResult, _asyncReads, pool, clearOnReturn, _cancelOnEarlyStop);
117+
return new(Query, _source, _singleResult, _asyncReads, pool, clearOnReturn, _cancelOnEarlyStop, _sequentialAccess);
107118
}
108119

109120
/// <inheritdoc cref="DbQuery.Params{TParams}"/>
@@ -194,6 +205,7 @@ internal MappedQuery<T> View(DbQueryCall call)
194205
if (_singleResult) view = view.SingleResult();
195206
if (_cancelOnEarlyStop) view = view.CancelOnEarlyStop();
196207
if (_asyncReads) view = view.AsyncReads();
208+
if (_sequentialAccess) view = view.SequentialAccess();
197209
if (_pool is not null) view = view.UsePool(_pool, _clearOnReturn);
198210
return view;
199211
}
@@ -227,6 +239,10 @@ public MappedDbQuery<TParams, T> CancelOnEarlyStop()
227239
public MappedDbQuery<TParams, T> AsyncReads()
228240
=> new(_definition.AsyncReads());
229241

242+
/// <inheritdoc cref="MappedDbQuery{T}.SequentialAccess"/>
243+
public MappedDbQuery<TParams, T> SequentialAccess()
244+
=> new(_definition.SequentialAccess());
245+
230246
/// <inheritdoc cref="MappedDbQuery{T}.UsePool(ArrayPool{T}, bool)"/>
231247
public MappedDbQuery<TParams, T> UsePool(ArrayPool<T> pool, bool clearOnReturn)
232248
// The definition throws ArgumentNullException for a null pool.

‎Source/Core/MappedQuery.cs‎

Lines changed: 36 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,7 @@ public static MappedQuery<T> Map<T>(
148148
/// <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>
149149
/// <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>
150150
/// <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>
151152
/// <param name="config">The pool, the clear rule, the chunk sizes and the bin the pooling terminals use.</param>
152153
readonly struct MappedQueryCore<T>(
153154
IExecuteReader? command,
@@ -158,22 +159,17 @@ readonly struct MappedQueryCore<T>(
158159
bool singleResult,
159160
bool asyncReads,
160161
bool cancelOnEarlyStop,
162+
bool sequentialAccess,
161163
ChunkConfig<T> config)
162164
: IEquatable<MappedQueryCore<T>>
163165
{
164-
/// <summary>
165-
/// The reader behavior of a generated mapping.
166-
/// </summary>
167-
// Generated mappings read each column once, in order, so the provider may stream the row.
168-
// A caller-supplied selector may read in any order, so it runs with the default access mode.
169-
const CommandBehavior GeneratedMapping = CommandBehavior.SingleResult | CommandBehavior.SequentialAccess;
170-
171166
readonly IRowSource<T> _source = source;
172167
readonly int _skip = skip;
173168
readonly int _take = take; // -1 == unbounded.
174169
readonly bool _singleResult = singleResult; // SingleResult() was called: stop after the first result set and do not read through the rest.
175170
readonly bool _asyncReads = asyncReads; // AsyncReads() was called: the rows of an async terminal are read with ReadAsync (the default is Read).
176171
readonly bool _cancelOnEarlyStop = cancelOnEarlyStop; // CancelOnEarlyStop() was called: see ReaderAbandon.
172+
readonly bool _sequentialAccess = sequentialAccess; // SequentialAccess() was called on the query.
177173

178174
/// <summary>
179175
/// The command, or <see langword="null"/> for a default value.
@@ -248,6 +244,7 @@ public bool Equals(MappedQueryCore<T> other)
248244
&& _singleResult == other._singleResult
249245
&& _asyncReads == other._asyncReads
250246
&& _cancelOnEarlyStop == other._cancelOnEarlyStop
247+
&& _sequentialAccess == other._sequentialAccess
251248
&& ReferenceEquals(Config, other.Config);
252249

253250
public override bool Equals(object? obj)
@@ -262,6 +259,7 @@ public override int GetHashCode()
262259
h = h * 31 + _skip;
263260
h = h * 31 + _take;
264261
return h * 31
262+
+ (_sequentialAccess ? 8 : 0)
265263
+ (_cancelOnEarlyStop ? 4 : 0)
266264
+ (_singleResult ? 2 : 0)
267265
+ (_asyncReads ? 1 : 0)
@@ -273,15 +271,18 @@ public override int GetHashCode()
273271
/// Gets the <see cref="CommandBehavior"/> the reader is asked for.
274272
/// </summary>
275273
// Without SingleResult() the reader is asked for every result set, because a terminal reads through the later ones to report their failures.
276-
CommandBehavior Behavior => _singleResult
277-
? (_source is SelectorSource<T> ? CommandBehavior.SingleResult : GeneratedMapping)
278-
: (_source is SelectorSource<T> ? CommandBehavior.Default : CommandBehavior.SequentialAccess);
274+
// SequentialAccess() called on the command is added by the command itself when it opens the reader.
275+
CommandBehavior Behavior
276+
=> (_singleResult ? CommandBehavior.SingleResult : CommandBehavior.Default)
277+
| (_sequentialAccess ? CommandBehavior.SequentialAccess : CommandBehavior.Default);
279278

280-
public MappedQueryCore<T> WithSingleResult() => Checked(new(_command, _call, _source, _skip, _take, true, _asyncReads, _cancelOnEarlyStop, Config));
279+
public MappedQueryCore<T> WithSingleResult() => Checked(new(_command, _call, _source, _skip, _take, true, _asyncReads, _cancelOnEarlyStop, _sequentialAccess, Config));
281280

282-
public MappedQueryCore<T> WithAsyncReads() => Checked(new(_command, _call, _source, _skip, _take, _singleResult, true, _cancelOnEarlyStop, Config));
281+
public MappedQueryCore<T> WithAsyncReads() => Checked(new(_command, _call, _source, _skip, _take, _singleResult, true, _cancelOnEarlyStop, _sequentialAccess, Config));
283282

284-
public MappedQueryCore<T> WithCancelOnEarlyStop() => Checked(new(_command, _call, _source, _skip, _take, _singleResult, _asyncReads, true, Config));
283+
public MappedQueryCore<T> WithCancelOnEarlyStop() => Checked(new(_command, _call, _source, _skip, _take, _singleResult, _asyncReads, true, _sequentialAccess, Config));
284+
285+
public MappedQueryCore<T> WithSequentialAccess() => Checked(new(_command, _call, _source, _skip, _take, _singleResult, _asyncReads, _cancelOnEarlyStop, true, Config));
285286

286287
/// <summary>
287288
/// Gets the configuration the query was given.
@@ -318,11 +319,11 @@ public MappedQueryCore<T> WithPool(ArrayPool<T> pool, bool clearOnReturn)
318319
/// <param name="config">The configuration to use.</param>
319320
/// <returns>A copy of the query that uses <paramref name="config"/>.</returns>
320321
public MappedQueryCore<T> WithConfig(ChunkConfig<T> config)
321-
=> Checked(new(_command, _call, _source, _skip, _take, _singleResult, _asyncReads, _cancelOnEarlyStop, config));
322+
=> Checked(new(_command, _call, _source, _skip, _take, _singleResult, _asyncReads, _cancelOnEarlyStop, _sequentialAccess, config));
322323

323324
/// <summary>Returns the same query over another call.</summary>
324325
public MappedQueryCore<T> WithCall(DbQueryCall call)
325-
=> new(null, call, _source, _skip, _take, _singleResult, _asyncReads, _cancelOnEarlyStop, Config);
326+
=> new(null, call, _source, _skip, _take, _singleResult, _asyncReads, _cancelOnEarlyStop, _sequentialAccess, Config);
326327

327328
public MappedQueryCore<T> WithSkip(int count)
328329
=> count >= 0
@@ -335,6 +336,7 @@ public MappedQueryCore<T> WithSkip(int count)
335336
_singleResult,
336337
_asyncReads,
337338
_cancelOnEarlyStop,
339+
_sequentialAccess,
338340
Config))
339341
: throw new ArgumentOutOfRangeException(nameof(count), count, "Cannot be negative.");
340342

@@ -357,6 +359,7 @@ public MappedQueryCore<T> WithTake(int count)
357359
_singleResult,
358360
_asyncReads,
359361
_cancelOnEarlyStop,
362+
_sequentialAccess,
360363
Config))
361364
: throw new ArgumentOutOfRangeException(nameof(count), count, "Cannot be negative.");
362365

@@ -801,9 +804,6 @@ static async (reader, s) =>
801804
return found ? row! : throw RowReader.NoRows(nameof(SingleAsync));
802805
}
803806

804-
// AnyAsync and CountAsync map nothing and touch no column, so the provider may stream the row whatever the source is.
805-
CommandBehavior NoColumnBehavior => _singleResult ? GeneratedMapping : CommandBehavior.SequentialAccess;
806-
807807
public ValueTask<bool> AnyAsync(CancellationToken cancellationToken)
808808
{
809809
ReaderAbandon? abandon = NewAbandon();
@@ -813,10 +813,7 @@ public ValueTask<bool> AnyAsync(CancellationToken cancellationToken)
813813
(_skip, _take, _asyncReads, abandon, token),
814814
static (reader, s) => RowReader.AnyAsync(
815815
reader, s._skip, s._take, s._asyncReads, s.token, s.abandon),
816-
// As FirstBehavior.
817-
UseSingleRow
818-
? NoColumnBehavior | CommandBehavior.SingleRow
819-
: NoColumnBehavior,
816+
FirstBehavior,
820817
abandon, linked, token);
821818
}
822819

@@ -829,7 +826,7 @@ public ValueTask<int> CountAsync(CancellationToken cancellationToken)
829826
(_skip, _take, _asyncReads, abandon, token),
830827
static (reader, s) => RowReader.CountAsync(
831828
reader, s._skip, s._take, s._asyncReads, s.token, s.abandon),
832-
NoColumnBehavior, abandon, linked, token);
829+
Behavior, abandon, linked, token);
833830
}
834831

835832
public ImmutableArray<T> ToImmutableArray()
@@ -1213,6 +1210,16 @@ public readonly record struct MappedQuery<T>
12131210
// A selector map (Map(Func)) on one very large value reads slower and uses more memory with ReadAsync.
12141211
public MappedQuery<T> AsyncReads() => new(_core.WithAsyncReads());
12151212

1213+
/// <summary>Asks the reader for <see cref="CommandBehavior.SequentialAccess"/>, for very large text or binary values.</summary>
1214+
/// <remarks>
1215+
/// The provider then streams each row instead of buffering it, and a column can be read once, in ascending order:
1216+
/// a selector given to <c>Map</c> must read the columns in that order, or the provider throws.
1217+
/// Without it the library reads with the default access mode. It can be called in any order with <c>Skip</c>, <c>Take</c> and <c>SingleResult</c>.
1218+
/// To read one large value as a stream, call <c>SequentialAccess()</c> on the command and use <c>reader.GetStream</c> in a reader callback.
1219+
/// </remarks>
1220+
/// <returns>The same query, reading with sequential access.</returns>
1221+
public MappedQuery<T> SequentialAccess() => new(_core.WithSequentialAccess());
1222+
12161223
/// <summary>
12171224
/// Chooses the pool this query's pooled arrays are rented from, and
12181225
/// whether their rows are cleared when they go back.
@@ -1767,6 +1774,9 @@ public readonly record struct MappedQueryWithSkip<T>
17671774
/// <inheritdoc cref="MappedQuery{T}.AsyncReads"/>
17681775
public MappedQueryWithSkip<T> AsyncReads() => new(_core.WithAsyncReads());
17691776

1777+
/// <inheritdoc cref="MappedQuery{T}.SequentialAccess"/>
1778+
public MappedQueryWithSkip<T> SequentialAccess() => new(_core.WithSequentialAccess());
1779+
17701780
/// <inheritdoc cref="MappedQuery{T}.UsePool(ArrayPool{T}, bool)"/>
17711781
public MappedQueryWithSkip<T> UsePool(ArrayPool<T> pool, bool clearOnReturn)
17721782
=> new(_core.WithPool(pool, clearOnReturn));
@@ -1907,6 +1917,9 @@ public readonly record struct MappedQueryWithTake<T>
19071917
/// <inheritdoc cref="MappedQuery{T}.AsyncReads"/>
19081918
public MappedQueryWithTake<T> AsyncReads() => new(_core.WithAsyncReads());
19091919

1920+
/// <inheritdoc cref="MappedQuery{T}.SequentialAccess"/>
1921+
public MappedQueryWithTake<T> SequentialAccess() => new(_core.WithSequentialAccess());
1922+
19101923
/// <inheritdoc cref="MappedQuery{T}.UsePool(ArrayPool{T}, bool)"/>
19111924
public MappedQueryWithTake<T> UsePool(ArrayPool<T> pool, bool clearOnReturn)
19121925
=> new(_core.WithPool(pool, clearOnReturn));

‎Source/Core/MappedViews.cs‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -352,6 +352,7 @@ static MappedQueryCore<T> NewCore<T>(
352352
singleResult,
353353
asyncReads,
354354
false,
355+
false,
355356
Defaults<T>.Config);
356357

357358
/// <summary>
@@ -885,6 +886,10 @@ public MappedCommand<T> CancelOnEarlyStop()
885886
public MappedCommand<T> AsyncReads()
886887
=> new(_core.WithAsyncReads());
887888

889+
/// <inheritdoc cref="MappedQuery{T}.SequentialAccess"/>
890+
public MappedCommand<T> SequentialAccess()
891+
=> new(_core.WithSequentialAccess());
892+
888893
/// <inheritdoc cref="MappedQuery{T}.UsePool(ArrayPool{T}, bool)"/>
889894
public MappedCommand<T> UsePool(ArrayPool<T> pool, bool clearOnReturn)
890895
=> new(_core.WithPool(pool, clearOnReturn));

0 commit comments

Comments
 (0)