I have started experimenting with CQRS/ES and have created a very basic project, the idea is that I need to record details of model cars such as Matchbox, Corgi, Dinky, etc.
I have broken it down into 3 aggrigate roots:
Manufacturer (Matchbox, Corgi, Dinky)
Series (Matchbox->Hot Wheels, Matchbox->75s, etc)
Vehicles
A series must have a manufacturer, a vehicle must have a series.
I have created a number of commands and events to allow the creation of manufacturers and series e.g.
CreateManufacturer
CreateSeries
CreateVehicle
ManufacturerCreated
SeriesCreated
VehicleCreated
Before allowing the user to delete a manufacturer I would like to check that there are no series linked to it. Similarly I would like to ensure that there are no vehicles linked to a series before allowing it to be deleted.
How should this be handled? Should I create a service which uses the read models to determine if a manufactuer/series is in use before sending a DeleteManufactuer/DeleteSeries command or should the manufacturer/series domain objects (aggrigate roots) internally track the number of items linked to it using the Apply override (i'm using CQRSLite)?
If I go down the domain object path should the CreateSeries command be replaced with a AddSeries method on the manufacturer domain object?