Interface IProjectionMethodInvoker
- Namespace
- Stratara.Projections.Abstractions
- Assembly
- Stratara.Projections.dll
Reflection-based discovery + invocation helper that locates a projection's HandleAsync methods
and caches compiled delegates for hot-path dispatch.
public interface IProjectionMethodInvoker
- Extension Methods
Remarks
Implementations are expected to use process-lifetime caches keyed by (projectionType, eventType);
the cache plateaus once every registered projection has been dispatched against every event type it
declares a handler for.
Methods
GetOrCreateDelegate(IProjection, Type)
Returns a compiled delegate that invokes the projection's HandleAsync(eventType, CancellationToken) overload, or the cached no-op if the projection declares no handler for the type.
Func<IProjection, object, CancellationToken, Task> GetOrCreateDelegate(IProjection projection, Type eventType)
Parameters
projectionIProjectionThe projection that owns the handler.
eventTypeTypeThe event payload type (or wrapping IEvent<TEvent> type) to look up.
Returns
GetOrCreateRelevantEventTypes(IProjection)
Returns the distinct event types the projection declares HandleAsync overloads for, computing them on first call and caching thereafter.
Type[] GetOrCreateRelevantEventTypes(IProjection projection)
Parameters
projectionIProjectionThe projection to inspect.
Returns
- Type[]
IsNoOp(Func<IProjection, object, CancellationToken, Task>)
Returns true if the supplied delegate is the cached no-op (i.e. the projection declares no handler for that event type).
bool IsNoOp(Func<IProjection, object, CancellationToken, Task> delegateOperation)
Parameters
delegateOperationFunc<IProjection, object, CancellationToken, Task>The delegate to test.