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

            return((IDomainEvent)domainEventObject);
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 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();
        }