EventTag—readonly record struct(Type TagType, object Value)stored on each eventTagTypeRegistration— Wraps a strong-typed ID type (e.g.StudentId(Guid Value)) withValueTypeInfo,TableSuffix,SimpleType, and optionalAggregateTypeEventTagQuery— Builds OR'd conditions of(EventType?, TagType, TagValue)via fluentOr<TTag>(value)APIIEvent.WithTag()— Extension methods to attach tags to events; usesTagValueExtractor(compiled lambdas) to unwrap inner values
EventGraph— HoldsList<TagTypeRegistration>, exposesRegisterTagType<T>(),FindTagType(),TagTypesEventTagTable— One table per tag type:mt_event_tag_{suffix}with composite PK(value, seq_id), FK tomt_events.seq_id. Value column type maps from SimpleType (Guid→uuid, string→text, int→integer, etc.)EventGraph.FeatureSchema— YieldsEventTagTableinstances in schema object generation
InsertEventTagOperation— Rich mode: directINSERT (value, seq_id) VALUES (...)using pre-assigned sequenceInsertEventTagByEventIdOperation— Quick mode fallback:INSERT ... SELECT seq_id FROM mt_events WHERE id = @eventIdfor individual insert paths (Start/ExpectedVersion)QuickAppendEventFunction— Quick mode optimized: tag value arrays passed asvarchar[]parameters to the PL/pgSQL function; tags inserted inline in the same loop using the already-availableseqvariable
EventTagOperations— Static helper dispatching toQueueTagOperations()(Rich) orQueueTagOperationsByEventId()(Quick individual paths)
EventDocumentStorageGenerator.buildQuickAppendOperation()— Conditionally emitswriteAllTagValues(parameterBuilder)whengraph.TagTypes.Count > 0QuickAppendEventsOperationBase.writeAllTagValues()— Builds parallelstring?[]arrays per tag type from event tags, appends asNpgsqlDbType.Array | VarcharQuickEventAppender— Routes: function path skips separate tag ops (handled in-function); Start/ExpectedVersion paths queueInsertEventTagByEventIdOperation
EventStore.Dcb.cs— Session APIs:QueryByTagsAsync(),AggregateByTagsAsync<T>(),FetchForWritingByTags<T>(). Builds SQL with INNER JOINs to tag tables + OR'd WHERE conditionsAssertDcbConsistency—IStorageOperationqueued at fetch time, runs atSaveChangesAsync:EXISTSquery checks for events withseq_id > lastSeenSequencematching the tag query. ThrowsDcbConcurrencyExceptionif violatedIEventBoundary<T>/EventBoundary<T>— Wraps query result:Aggregate,Events,LastSeenSequence.AppendOne()/AppendMany()route new events to streams by tag valuesFetchForWritingByTagsHandler<T>—IQueryHandlerfor batch query support; same SQL building + assertion registration
IBatchEvents.FetchForWritingByTags<T>()— Interface onIBatchedQueryBatchedQuery.Events.cs— Delegates toFetchForWritingByTagsHandler<T>viaAddItem()
| File | Purpose |
|---|---|
JasperFx.Events/EventTag.cs |
Core tag value type |
JasperFx.Events/Tags/TagTypeRegistration.cs |
Tag type registration & value extraction |
JasperFx.Events/Tags/EventTagQuery.cs |
Query specification with OR'd conditions |
JasperFx.Events/IEvent.cs |
WithTag() extension methods |
JasperFx.Events/Event.cs |
Tag storage on event instances |
| File | Purpose |
|---|---|
Marten/Events/EventGraph.cs |
RegisterTagType<T>(), tag type list |
Marten/Events/EventGraph.FeatureSchema.cs |
Schema generation for tag tables |
Marten/Events/Schema/EventTagTable.cs |
Tag table DDL (per tag type) |
Marten/Events/Schema/QuickAppendEventFunction.cs |
PL/pgSQL function with inline tag inserts |
Marten/Events/Operations/InsertEventTagOperation.cs |
Rich mode tag insert |
Marten/Events/Operations/InsertEventTagByEventIdOperation.cs |
Quick mode tag insert (by event ID) |
Marten/Events/Operations/EventTagOperations.cs |
Static tag operation dispatcher |
Marten/Events/Operations/QuickAppendEventsOperationBase.cs |
writeAllTagValues() for function path |
Marten/Events/QuickEventAppender.cs |
Append routing (function vs individual) |
Marten/Events/CodeGeneration/EventDocumentStorageGenerator.cs |
Conditional tag codegen |
Marten/Events/EventStore.Dcb.cs |
Session-level DCB APIs |
Marten/Events/Dcb/IEventBoundary.cs |
Public boundary interface |
Marten/Events/Dcb/EventBoundary.cs |
Boundary implementation & event routing |
Marten/Events/Dcb/AssertDcbConsistency.cs |
Consistency check operation |
Marten/Events/Dcb/DcbConcurrencyException.cs |
Concurrency violation exception |
Marten/Events/Dcb/FetchForWritingByTagsHandler.cs |
Batch query handler |
Marten/Services/BatchQuerying/BatchedQuery.Events.cs |
Batch query integration |