So much of the benefits around Event Sourcing apply to the being able to audit the system and show an aggregate's state throughout its life. However, I haven't been able to find any examples of where to record who issued the command and when with was issued.
I have been doing a lot of my learning by dissecting the CQRS Journey on MSDN. The only place that I see any indication of who created something is in the ConferenceEvent
class.
public abstract class ConferenceEvent : IEvent
{
public Guid SourceId { get; set; }
// **snip**
public Owner Owner { get; set; }
}
I cannot find any indication that when the event occurs is ever recorded. Should every Command
have a CreatedOn
and CreatedBy
which then gets propagated to the Event
. Then, when rehydrating the aggregate, which would be inherited from the sample below, the events would know which who and when fields to populate?
public abstract class EventSourced : IEventSourced
{
[Required]
public string CreatedBy { get; set; }
public DateTime CreatedOn { get; set; }
public string LastModifiedBy { get; set; }
public DateTime? LastModifiedOn { get; set; }
public string DeletedOn { get; set; }
public DateTime? DeletedBy { get; set; }
}
Each event seems to intuitively be the why while containing the information for the what and where; but what for the other two dubya's?