Table of Contents

Class InMemoryDataSource<TItem>

Namespace
BlazOrbit.Components
Assembly
BlazOrbit.dll

Wraps an in-process System.Collections.Generic.IEnumerable<T> behind the IDataCollectionDataSource<TItem> contract. Used implicitly by BOBDataCollectionBase<TItem, TComponent, TVariant> when the consumer passes the legacy Items parameter — the component injects its column registry and optional custom global filter via the internal hooks so the locally applied pipeline matches the historical behaviour exactly.

Consumers building their own data-collection components can construct the source directly to share the filter / sort / page semantics — the constructor accepts a bare enumerable, the column metadata is wired separately when needed.

public sealed class InMemoryDataSource<TItem> : IDataCollectionDataSource<TItem>

Type Parameters

TItem

Row item type.

Inheritance
object
InMemoryDataSource<TItem>
Implements

Constructors

InMemoryDataSource(IEnumerable<TItem>)

Constructs an in-memory source over items.

public InMemoryDataSource(IEnumerable<TItem> items)

Parameters

items IEnumerable<TItem>

Backing collection. The source enumerates it on every LoadAsync(DataRequest, CancellationToken).

Properties

Items

Backing collection passed to the constructor.

public IEnumerable<TItem> Items { get; }

Property Value

IEnumerable<TItem>

Methods

LoadAsync(DataRequest, CancellationToken)

Loads the slice described by request. Implementations honour the page / page size, global filter, per-column filters and sort descriptors, and return both the materialised page and the total row count after filtering (the host component uses the total to compute pagination — the slice itself only contains the visible page).

public Task<DataResult<TItem>> LoadAsync(DataRequest request, CancellationToken cancellationToken = default)

Parameters

request DataRequest

User intent describing the desired slice.

cancellationToken CancellationToken

Token raised when a newer LoadAsync(DataRequest, CancellationToken) call supersedes this one (typing fast in a column filter, rapid pagination clicks). Long-running implementations should observe the token to avoid leaking work after the host component has moved on.

Returns

Task<DataResult<TItem>>

Page slice plus total filtered row count.