Table of Contents

Class InMemoryEnumeratorAdapter<TResult, TEntity>

Namespace
NextORM.Core
Assembly
nextorm.core.dll

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

TResult

The projected element type.

TEntity

The source element type.

Inheritance
InMemoryEnumeratorAdapter<TResult, TEntity>
Implements
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

cmd InMemoryCompiledQuery<TResult, TEntity>

The compiled in-memory query, supplying the projection and predicate.

inner IAsyncEnumerator<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

cmd InMemoryCompiledQuery<TResult, TEntity>

The compiled in-memory query, supplying the projection and predicate.

inner IAsyncEnumerator<TEntity>

The async source enumerator to pull rows from.

distinct bool

When 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

bool

MoveNextAsync()

Asynchronously advances to the next source row whose predicate passes, skipping already-seen projections when DISTINCT is active.

public ValueTask<bool> MoveNextAsync()

Returns

ValueTask<bool>

true when a row was found; otherwise false.

Reset()

Not supported: an asynchronous source cannot be rewound, so resetting throws.

public void Reset()

Exceptions

NotSupportedException

Always thrown.