Skip to main content

Workflow Application Layer

Summary

The application layer contains two command services, one query service, DTO/input records, mapping extensions, ports and a lightweight result type.

Services

WorkflowDefinitionCommands orchestrates create, update and publish. WorkflowInstanceCommands orchestrates start, approve, reject, delegate and stage execution. WorkflowQueries provides definition, instance, worklist and operational-feed reads.

Request flow

Endpoints bind inputs and call a scoped service. Commands obtain tenant/actor context, load aggregates through repositories, invoke domain methods, add audit/timeline entries and save once. Queries use no-tracking EF Core projections or entity-to-DTO mapping.

Result and error handling

Result<T> distinguishes success, validation, not-found and conflict. Endpoint translation maps these categories to HTTP results. Domain validation exceptions are caught by definition commands. Tenant-related invalid-operation exceptions are handled by middleware.

Mapping

Mapping extensions produce definition/version/step/condition, instance/task/action and definition-summary DTOs. They are projection helpers, not compatibility models.

Limitations

No mediator, behavior pipeline, separate validator framework, centralized exception contract or application-level authorization behavior exists.

Requires Confirmation

Error-contract standardization, mediator adoption and query-boundary direction require confirmation.

Source References

  • microservices/src/workflow-service/Application/Commands/WorkflowDefinitionCommands.cs
  • microservices/src/workflow-service/Application/Commands/WorkflowInstanceCommands.cs
  • microservices/src/workflow-service/Application/Queries/WorkflowQueries.cs
  • microservices/src/workflow-service/Application/Common/Cqrs.cs
  • microservices/src/workflow-service/Application/Mappings.cs

See Also

Keywords

Workflow architecture, approval engine, Workflow Service, technical foundation.

Revision Information

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