# Intent.AspNetCore.Controllers.Dispatch.ServiceContract

This module makes the controllers generated by `Intent.AspNetCore.Controllers` dispatch each request to an application service, through the service's contract interface.

## What this module generates

For each `Service` modelled in the Services designer, the controller:

- Takes the service's interface (for example `ICustomersService`) in its constructor.
- Calls the matching service operation from each action and returns its result.

## Unit of work and message bus

When a unit of work is available (for example from `Intent.EntityFrameworkCore`), each action that changes state runs inside a transaction and saves its changes before it returns. When a message bus is installed, those actions also flush the messages published while handling the request.

Actions for `GET` and `QUERY` operations are treated as read-only: they skip the unit of work and the message bus flush.
