Example #1
0
        async Task CreateProjectionFromEvents <TProjection>(IEnumerable <SourcedEvent> events, Action <TProjection> onLoaded) where TProjection : new()
        {
            var projection = new TProjection();

            var router = new MessageHandlerRouter();

            router.RegisterHandler(projection);

            foreach (var e in events)
            {
                await router.RouteMessageToHandlersAsync(e.Body);
            }

            router.UnregisterHandler(projection);
            onLoaded(projection);
        }
 async Task BuildFromEventAsync(object @event)
 {
     await eventRouter.RouteMessageToHandlersAsync(@event);
 }