예제 #1
0
        private static IDomainEvent ParseDomainEventEntityToDomainEvent(DomainEventEntity domainEventEntity)
        {
            var domainEventType   = Type.GetType(domainEventEntity.FullyQualifiedEventTypeName);
            var domainEventObject = JsonConvert.DeserializeObject(domainEventEntity.EventData, domainEventType);

            return((IDomainEvent)domainEventObject);
        }
예제 #2
0
        public void Store(IDomainEvent domainEvent)
        {
            var domainEventEntity = new DomainEventEntity
            {
                AggregateId   = domainEvent.AggregateId,
                CorrelationId = domainEvent.CorrelationId,
                CreationDate  = domainEvent.CreationDate,
                FullyQualifiedEventTypeName = domainEvent.GetType().AssemblyQualifiedName,
                EventData = JsonConvert.SerializeObject(domainEvent)
            };

            _dbSet.Add(domainEventEntity);
        }
예제 #3
0
        public async Task StoreAsync(IDomainEvent domainEvent)
        {
            var domainEventEntity = new DomainEventEntity
            {
                AggregateId   = domainEvent.AggregateId,
                CorrelationId = domainEvent.CorrelationId,
                CreationDate  = domainEvent.CreationDate,
                FullyQualifiedEventTypeName = domainEvent.GetType().AssemblyQualifiedName,
                EventData = JsonConvert.SerializeObject(domainEvent)
            };

            _dbSet.Add(domainEventEntity);
            await _context.SaveChangesAsync();
        }