Interface IRowAccumulator<TSelf, TModel>
Folds typed rows read by SheetParallel.AggregateAsync into a result. Each partition
of the sheet gets its own instance.
public interface IRowAccumulator<TSelf, TModel> where TSelf : IRowAccumulator<TSelf, TModel> where TModel : allows ref struct
Type Parameters
TSelfThe implementing type.
TModelThe record type, produced by TryParse(Row, out TSelf) or by an ExcelParser<T>.
Remarks
Add(TModel) runs concurrently across instances on worker threads, and must mutate only the instance it is called on. For CSV, a partition that started at a misguessed row boundary is read again into a new instance and the first one is discarded, so an instance may see rows that are later thrown away — including rows whose parse or Add(TModel) threw, and rows misparsed from the wrong start that appear nowhere in the sheet. A side effect outside the instance is not undone. XLSX and XLSB never re-read a partition.
Merge(TSelf) runs on a single thread, left to right in sheet order, folding each later partition into the accumulator of everything before it. It may receive an instance that saw no rows.
Methods
Add(TModel)
Folds one row into this instance.
void Add(TModel model)
Parameters
modelTModelThe row. Spans it holds are valid only for the duration of the call.
Merge(TSelf)
Folds the rows of the partition that immediately follows this one into this instance.
void Merge(TSelf following)
Parameters
followingTSelfThe accumulator of the following partition. It is not used again afterwards.