public TEntity GetById <TEntity>(object id) where TEntity : class, new()
        {
            if (!(id is Guid guidId))
            {
                throw new NotSupportedException("Id of the Event Sourced aggregate has to be Guid");
            }

            return(eventStore.Aggregate <TEntity>(guidId));
        }
Пример #2
0
        public TEntity FindById(object id)
        {
            if (!(id is Guid guidId))
            {
                throw new NotSupportedException("Id of the Event Sourced aggregate has to be Guid");
            }

            return(documentSession.Events.FetchStreamState(guidId) != null
                ? eventStore.Aggregate <TEntity>(guidId)
                : null);
        }