Beispiel #1
0
#pragma warning disable 1591 // Xml Comments
        public IEvent ToEvent(EventHolder eventHolder)
		{
			var logicalEventType = _eventMigrationHierarchyManager.GetLogicalTypeFromName(eventHolder.LogicalEventName);
			var concreteType = _eventMigrationHierarchyManager.GetConcreteTypeForLogicalEventMigrationLevel(logicalEventType, eventHolder.Generation);
			var @event = CreateInstance(concreteType, eventHolder.AggregateId);
			_serializer.FromJson(@event, eventHolder.SerializedEvent);
			return _eventMigratorManager.Migrate(@event);
		}
Beispiel #2
0
		public void ToEventHolder(EventHolder eventHolder, IEvent @event)
		{
			var eventType = @event.GetType();
			var logicalEventType = _eventMigrationHierarchyManager.GetLogicalTypeForEvent(eventType);
			var generation = _eventMigrationHierarchyManager.GetCurrentMigrationLevelForLogicalEvent(logicalEventType);
			var aggregatedRootName = GetAggregatedRootNameFromEvent(@event);
			eventHolder.Id = @event.Id;
			eventHolder.CommandName = @event.CommandName;
			eventHolder.Name = @event.Name;
			eventHolder.AggregateId = @event.EventSourceId;
			eventHolder.AggregatedRoot = aggregatedRootName;
            eventHolder.EventSourceName = @event.EventSourceName;
			eventHolder.SerializedEvent = _serializer.ToJson(@event);
			eventHolder.LogicalEventName = logicalEventType.Name;
			eventHolder.Generation = generation;
            eventHolder.CausedBy = @event.CausedBy;
            eventHolder.Origin = @event.Origin;
			eventHolder.Occured = @event.Occured;
			eventHolder.Version = @event.Version.Combine();
		}
Beispiel #3
0
		public EventHolder ToEventHolder(IEvent @event)
		{
			var eventHolder = new EventHolder();
			ToEventHolder(eventHolder, @event);
			return eventHolder;
		}