Skip to main content

Asset Persistence Adapters

EF Core adapter

AssetDbContext uses EF Core 8 with the PostgreSQL provider. Fluent configuration maps the aggregate, owned value objects, child entities, audit, timeline, processed-event ledger, and shared outbox record. Status and condition enums convert to strings. Child records cascade with the aggregate. Indexes support compatibility identity, status/type tenant lookups, workflow instance, child ownership, timeline/audit lookup, and event uniqueness.

Global query filters apply tenant scope to aggregate, children, audit, and timeline, with a tenant-context super-administrator bypass. Code lookup uses a non-unique index; tenant-scoped uniqueness is enforced in application code. SaveChanges finds aggregate domain events, maps them to shared contracts, writes outbox records, then clears the in-memory events.

One initial migration and model snapshot are present. Development startup can migrate and seed available, issued, and requested examples. Design-time context and the Backfill folder support schema tooling and transitional import. Database schema specifics are deferred to the Database epic; this page intentionally omits connection and infrastructure values.

Requires confirmation

Production ownership, authorization governance, operational policy, and future architecture require confirmation where the source does not enforce them.

Source References

  • microservices/src/asset-service/Infrastructure/AssetDbContext.cs
  • microservices/src/asset-service/Infrastructure/Persistence.cs
  • microservices/src/asset-service/Infrastructure/DevelopmentSeeder.cs
  • microservices/src/asset-service/Infrastructure/Migrations/20260707123634_InitialAssetSchema.cs