event-store

Configure EF Core event storage with discriminator-based table-per-hierarchy mapping.

4|1|Updated Mar 15, 2026
One-click install
npx skills add https://github.com/FaysilAlshareef/dotnet-ai-kit --skill event-store-faysilalshareef
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: event-store
Source: https://github.com/FaysilAlshareef/dotnet-ai-kit/tree/main/skills/microservice/command/event-store
Command: npx skills add https://github.com/FaysilAlshareef/dotnet-ai-kit --skill event-store-faysilalshareef

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill helps .NET developers configure EF Core as an append-only event store using a table-per-hierarchy discriminator, JSON-serialized event payloads, and an outbox message linkage to ensure consistent event sourcing, prevent duplicate events, and integrate reliable message delivery.

Core Features & Use Cases

  • TPH Event Store: Maintain a single Events DbSet and use a discriminator column mapped from an EventType enum to concrete event classes.
  • Generic JSON Data Conversion: Register GenericEventConfiguration<TEntity,TData> to serialize and deserialize the Data column using Newtonsoft.Json with StringEnumConverter and NullValueHandling.Ignore.
  • Outbox Integration & Safety: Configure OutboxMessage as a shared primary key/foreign key to Event.Id and enforce a unique composite index on (AggregateId, Sequence) to prevent duplicates.
  • Use Case: Add a new domain event type, update EventConfiguration with HasValue<NewEvent>(EventType.NewEvent), add a GenericEventConfiguration registration, and run EF Core migrations to persist the new event reliably.

Quick Start

Register EventConfiguration and GenericEventConfiguration for each concrete event type in ApplicationDbContext.OnModelCreating and run EF Core migrations.

Frequently Asked Questions about event-store

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I configure an EF Core event store using table-per-hierarchy mapping?

Configure an EF Core event store by maintaining a single Events DbSet and mapping a discriminator column from an EventType enum to concrete event classes using HasValue<T> in EventConfiguration.

How does Newtonsoft.Json serialization work for event-sourced aggregates in EF Core?

Event Data serialization uses Newtonsoft.Json with StringEnumConverter and NullValueHandling.Ignore by registering GenericEventConfiguration<TEntity,TData> for each concrete event type during model creation.

What's the best way to prevent duplicate events in a .NET microservice command store?

Prevent duplicate events by enforcing a unique composite index on the AggregateId and Sequence columns within your EF Core event store configuration to guarantee sequence integrity.

How do I integrate an outbox pattern with EF Core event sourcing?

Integrate the outbox pattern by configuring OutboxMessage as a shared primary key and foreign key to Event.Id, ensuring reliable message delivery alongside consistent event sourcing.

Do I need to register GenericEventConfiguration for each new domain event type?

Yes, you must register GenericEventConfiguration for each new domain event type, update EventConfiguration with the new discriminator mapping, and run EF Core migrations to persist it.

When do I need discriminator mapping for an append-only event store?

You need discriminator mapping when configuring a single table-per-hierarchy Events table to store multiple concrete event classes differentiated by an EventType enum column.