Implementing domain services
A domain service is another class in which we implement the domain rules and constraints. Domain services are typically needed when we need to work with multiple aggregates, and the business logic doesn't properly fit into any of these aggregates. Domain services are also used when we need to consume other services and repositories since they can use the dependency injection system.
Let's re-implement the SetCapacityAsync
method (in the previous section) as a domain service method:
public class EventManager : DomainService { ... public async Task SetCapacityAsync(Event @event, int? capacity) { ...