private async Task OnDelete(ProjectorMap <TProjection, TKey, TContext> projector, Func <TEvent, TKey> getKey, TEvent anEvent, TContext context) { TKey key = getKey(anEvent); bool deleted = await projector.Delete(key, context); if (!deleted) { handleMissing(key, context); } }
/// <summary> /// Builds the resulting event map. /// </summary> /// <remarks> /// Can only be called once. /// No changes can be made after the event map has been built. /// </remarks> /// <param name="projector"> /// Contains the handler that a projector needs to support to handle events from this map. /// </param> public IEventMap <TContext> Build(ProjectorMap <TContext> projector) { AssertNotBuilt(); if (projector == null) { throw new ArgumentNullException(nameof(projector)); } if (projector.Custom == null) { throw new ArgumentException( $"Expected the Custom property to point to a valid instance of {nameof(CustomHandler<TContext>)}", nameof(projector)); } this.projector = projector; return(eventMap); }