Metadata
Metadata is all the "additional" information that resides with an emitted event, some of which is required information.
In EventFlow, metadata is merely an IEnumerable of
KeyValuePair<string,string> for which each is a metadata entry.
Out of the box, these metadata keys are added to each aggregate event:
event_nameandevent_version- A name and version for the event which is used during event deserialization.timestamp- ADateTimeOffsetfor when the event was emitted from the aggregate.aggregate_sequence_number- The version the aggregate was after the event was emitted, e.g.,1for the very first event emitted.
Custom metadata provider
If you require additional information to be stored along with each
event, you can implement the IMetadataProvider interface and
register the class using e.g., .AddMetadataProvider(...) on
EventFlowOptions.
Additional built-in providers
EventFlow ships with a collection of ready-to-use providers in some of its NuGet packages.
EventFlow
-
AddEventTypeMetadataProviderevent_type_assembly_name- Assembly name of the assembly containing the event.event_type_assembly_version- Assembly version of the assembly containing the event.event_type_fullname- Full name of the event corresponding toType.FullNamefor the aggregate event type.
-
AddGuidMetadataProviderguid- A newGuidfor each event.
-
AddMachineNameMetadataProviderenvironment_machinename- Adds the machine name handling the event fromEnvironment.MachineName.