public async Task <AggregateModel> HandleAsync(GetAggregateModel query)
        {
            var events = await _domainStore.GetEventsAsync(query.AggregateRootId);

            var aggregate = new AggregateModel(events);

            return(aggregate);
        }
Beispiel #2
0
        public async Task <T> GetByIdAsync(Guid id)
        {
            var events = await _domainStore.GetEventsAsync(id);

            var domainEvents = events as DomainEvent[] ?? events.ToArray();

            if (!domainEvents.Any())
            {
                return(default);
Beispiel #3
0
        /// <inheritdoc />
        public async Task <T> GetByIdAsync(Guid id)
        {
            var events = await _domainStore.GetEventsAsync(id);

            var domainEvents = events as DomainEvent[] ?? events.ToArray();

            if (!domainEvents.Any())
            {
                return(default(T));
            }

            var aggregate = Activator.CreateInstance <T>();

            aggregate.LoadsFromHistory(domainEvents);
            return(aggregate);
        }