Skip to main content

Workflow Instance Storage

Summary

WorkflowInstance is the execution aggregate root and owns tasks and actions.

Mapping

The application assigns its GUID. Definition/version references, tenant, key, status, current order, initiator and start time are stored. Subject fields, structured context, result and completion time are optional. Status converts to text; context uses a structured JSON column. Domain events are ignored by entity mapping.

Relationships

One instance owns many tasks and actions with required foreign keys and cascade deletion. Definition/version identifiers are stored as references but are not configured as database foreign keys.

Indexes

Composite indexes support tenant/status and tenant/workflow-key queries. Tenant filtering applies.

Lifecycle

Start inserts the aggregate and first tasks/actions. Decisions update tasks/state and add actions. Completion/rejection set terminal fields.

Requires Confirmation

Referential integrity to definition/version, retention, subject-reference integrity and concurrency require confirmation.

Source References

  • microservices/src/workflow-service/Domain/Workflow/WorkflowInstance.cs
  • microservices/src/workflow-service/Infrastructure/WorkflowDbContext.cs
  • microservices/src/workflow-service/Infrastructure/Migrations/20260706165438_InitialWorkflowSchema.cs

See Also

Keywords

Workflow database, EF Core, Workflow schema.

Revision Information

  • Status: Draft
  • Last reviewed: 2026-07-20
  • Next review: 2026-10-20