Summary
Add MapInContextAsync — an async LINQ-like transform of IEnumerable<TIn> → results, where each item's transform runs inside a safe context scope.
Goal
Provide a clean, readable alternative to a hand-written Select(...) + Task.WhenAll loop that loses/leaks ambient context.
Problem
The current parallel primitives are single-action or all-delegates. Transforming a collection item-by-item with proper context isolation is boilerplate and error-prone:
// ❌ manual
var tasks = items.Select(i => manager.ExecuteInContext(ctx, () => Transform(i)));
var results = await Task.WhenAll(tasks);
Scope
Design Expectations
- Composes with the base fork-join execution primitive.
- Reuses per-item
BeginContext/snapshot; no new runtime primitive.
- Async-only;
ConfigureAwait(false) internally.
Acceptance Criteria
Non-Goals
- No concurrency limiting (lives in
MapParallel/MaxConcurrency).
- No partial-success handling (lives in
TryEach).
- No chunking.
Summary
Add
MapInContextAsync— an async LINQ-like transform ofIEnumerable<TIn>→ results, where each item's transform runs inside a safe context scope.Goal
Provide a clean, readable alternative to a hand-written
Select(...)+Task.WhenAllloop that loses/leaks ambient context.Problem
The current parallel primitives are single-action or all-delegates. Transforming a collection item-by-item with proper context isolation is boilerplate and error-prone:
Scope
IContextManager<C>.MapInContextAsync(C ctx, IEnumerable<TIn>, Func<TIn,Task<TOut>>).Design Expectations
BeginContext/snapshot; no new runtime primitive.ConfigureAwait(false)internally.Acceptance Criteria
Non-Goals
MapParallel/MaxConcurrency).TryEach).