Esempio n. 1
0
 /// <summary>
 /// Initializes a new instance of <see cref="EventEnvelope"/>
 /// </summary>
 /// <param name="correlationId"><see cref="TransactionCorrelationId"/> the <see cref="IEvent"/> is part of</param>
 /// <param name="eventId"><see cref="EventId"/> for the <see cref="IEvent"/></param>
 /// <param name="sequenceNumber"></param>
 /// <param name="sequenceNumberForEventType"></param>
 /// <param name="generation"><see cref="EventGeneration"/> for the <see cref="IEvent"/> </param>
 /// <param name="event"><see cref="IApplicationResourceIdentifier"/> representing the <see cref="IEvent"/></param>
 /// <param name="eventSourceId"><see cref="EventSourceId"/> for the <see cref="IEventSource"/></param>
 /// <param name="eventSource"><see cref="IApplicationResourceIdentifier"/> representing the <see cref="IEventSource"/></param>
 /// <param name="version"><see cref="EventSourceVersion">Version</see> of the event related to the <see cref="IEventSource"/></param>
 /// <param name="causedBy"><see cref="string"/> representing which person or what system caused the event</param>
 /// <param name="occurred"><see cref="DateTime">When</see> the event occured</param>
 public EventEnvelope(
     TransactionCorrelationId correlationId,
     EventId eventId,
     EventSequenceNumber sequenceNumber,
     EventSequenceNumber sequenceNumberForEventType,
     EventGeneration generation,
     IApplicationResourceIdentifier @event,
     EventSourceId eventSourceId,
     IApplicationResourceIdentifier eventSource,
     EventSourceVersion version,
     CausedBy causedBy,
     DateTimeOffset occurred)
 {
     CorrelationId              = correlationId;
     EventId                    = eventId;
     SequenceNumber             = sequenceNumber;
     SequenceNumberForEventType = sequenceNumberForEventType;
     Generation                 = generation;
     Event         = @event;
     EventSourceId = eventSourceId;
     EventSource   = eventSource;
     Version       = version;
     CausedBy      = causedBy;
     Occurred      = occurred;
 }
Esempio n. 2
0
        public Type GetTargetTypeForGeneration(Type logicalEvent, EventGeneration level)
        {
            if (level < 0)
            {
                throw new MigrationLevelOutOfRangeException(string.Format("The lowest possible migration level is 0.  You asked for {0}", level));
            }


            var  hierarchy = GetHierarchyForLogicalType(logicalEvent);
            Type type;

            try
            {
                type = hierarchy.GetConcreteTypeForLevel(level);
            }
            catch (Exception)
            {
                throw new MigrationLevelOutOfRangeException(string.Format(
                                                                "The maximum migration level for the logical event {0} is {1}.  Does not have a migration level of {2}",
                                                                logicalEvent.FullName, hierarchy.MigrationLevel, level
                                                                ));
            }

            return(type);
        }