Ejemplo n.º 1
0
                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);
                    }
                }
Ejemplo n.º 2
0
        /// <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);
        }