In Vertical Slice Architecture (VSA) you are supposed to have a class for pretty much every operation you can do (as I understand it). Some example, also mentioned in the referenced article, are:
- Get orders
- Approve invoice
- Cancel order
So if you want to approve an invoice, it is done via the ApproveInvoiceService
class (or however you decided to name it).
But what about updating properties, which are typically controlled by the domain object? For example, if I have a Customer domain object, I could come up with quite a few properties which could potentially be changed/updated:
- First name
- Last name
- Phone number
- Address
- Gender (although more rare)
- etc.
The validation of all these would, presummably, lie on the domain object. The Customer
class. Hence, if I made a service for changing each of these properties, they would essentially look the same:
- Try update domain object
- Persist changes to database
I haven't been able to find anything about this, in regards to VSA. Is it really the intention, to make so many similar services/handlers/whatever-we-call-them?