Class InMemoryEnumeratorAdapter<TResult, TEntity>
Adapts an asynchronous IAsyncEnumerator<T> of source rows to the query's
TResult projection. Used when an in-memory subquery is backed by an async
source that has no synchronous counterpart; it applies the predicate and, when requested, the
DISTINCT filter as rows are pulled.
public class InMemoryEnumeratorAdapter<TResult, TEntity> : IAsyncEnumerator<TResult>, IAsyncDisposable, IEnumerator<TResult>, IEnumerator, IDisposable, IEnumerable<TResult>, IEnumerable
Type Parameters
TResultThe projected element type.
TEntityThe source element type.
- Inheritance
-
InMemoryEnumeratorAdapter<TResult, TEntity>
- Implements
-
IAsyncEnumerator<TResult>IEnumerator<TResult>IEnumerable<TResult>
- Inherited Members
- Extension Methods
Constructors
InMemoryEnumeratorAdapter(InMemoryCompiledQuery<TResult, TEntity>, IAsyncEnumerator<TEntity>)
Initializes an adapter over the given asynchronous source enumerator.
public InMemoryEnumeratorAdapter(InMemoryCompiledQuery<TResult, TEntity> cmd, IAsyncEnumerator<TEntity> inner)
Parameters
cmdInMemoryCompiledQuery<TResult, TEntity>The compiled in-memory query, supplying the projection and predicate.
innerIAsyncEnumerator<TEntity>The async source enumerator to pull rows from.
InMemoryEnumeratorAdapter(InMemoryCompiledQuery<TResult, TEntity>, IAsyncEnumerator<TEntity>, bool)
Initializes an adapter over the given asynchronous source enumerator, optionally de-duplicating the projection.
public InMemoryEnumeratorAdapter(InMemoryCompiledQuery<TResult, TEntity> cmd, IAsyncEnumerator<TEntity> inner, bool distinct)
Parameters
cmdInMemoryCompiledQuery<TResult, TEntity>The compiled in-memory query, supplying the projection and predicate.
innerIAsyncEnumerator<TEntity>The async source enumerator to pull rows from.
distinctboolWhen true, projected values are de-duplicated as they are produced, matching
SELECT DISTINCT.
Properties
Current
Gets the projection of the current source row.
public TResult Current { get; }
Property Value
- TResult
Methods
Dispose()
Suppresses finalization. The inner source is released by DisposeAsync(), not here.
public void Dispose()
DisposeAsync()
Asynchronously disposes the inner source enumerator.
public ValueTask DisposeAsync()
Returns
- ValueTask
The task returned by the inner enumerator's dispose operation.
GetEnumerator()
Returns this instance as a synchronous enumerator. Synchronous moves require the inner source to also implement IEnumerator<T>.
public IEnumerator<TResult> GetEnumerator()
Returns
- IEnumerator<TResult>
This enumerator.
MoveNext()
Synchronous enumeration over a buffered subquery. The inner enumerator of a buffered in-memory subquery implements IEnumerator<T>; an async inner source has no synchronous counterpart and is rejected.
public bool MoveNext()
Returns
MoveNextAsync()
Asynchronously advances to the next source row whose predicate passes, skipping
already-seen projections when DISTINCT is active.
public ValueTask<bool> MoveNextAsync()
Returns
Reset()
Not supported: an asynchronous source cannot be rewound, so resetting throws.
public void Reset()
Exceptions
- NotSupportedException
Always thrown.