Skip to main content

Workflow Database Query Patterns

Summary

Writes load aggregates through repositories; reads use direct no-tracking DbContext queries and DTO mapping.

Definition queries

Repositories load definitions by identifier with version/step/condition includes, resolve published definitions by tenant/key and test tenant/key existence. List queries order summaries by key.

Instance and task queries

Instance mutation loads include tasks/actions, including lookup by contained task. Instance reads include tasks. Pending worklists match caller email or roles, join instances and order by task creation time.

Operational queries

Audit, timeline and outbox reads order newest-first and clamp result size. Health diagnostics count definitions, published definitions, instances and pending tasks.

Outbox relay queries

The store reads Pending or Failed records oldest-first in a bounded batch, then loads individual records to update publication status.

Limitations

No compiled queries, specification layer, cursor paging, completed-task history, instance list, subject index/query, cache or query-performance tests were found.

Requires Confirmation

Paging, reporting, high-volume query plans and index tuning require confirmation.

Source References

  • microservices/src/workflow-service/Infrastructure/Persistence.cs
  • microservices/src/workflow-service/Application/Queries/WorkflowQueries.cs
  • microservices/src/workflow-service/Api/WorkflowEndpoints.cs

See Also

Keywords

Workflow database, EF Core, Workflow schema.

Revision Information

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