Example #1
0
        /// <summary>
        /// Convertors the specified aggregate identifier.
        /// </summary>
        /// <param name="aggregateId">The aggregate identifier.</param>
        /// <param name="event">The event.</param>
        /// <returns></returns>
        /// <exception cref="System.Exception">Could not find EventType {eventType.Name} in mapping list.</exception>
        public static IDomainEvent Convertor(Guid aggregateId,
                                             ResolvedEvent @event)
        {
            //TODO: We could pass this Type into GetDomainEvent(s)
            var eventType = TypeMap.GetType(@event.Event.EventType);

            if (eventType.IsSubclassOf(typeof(DomainEvent)))
            {
                return(TypeMapConvertor.GetDomainEvent(aggregateId, @event));
            }

            throw new Exception($"Could not find EventType {eventType.Name} in mapping list.");
        }