Follow this guide to implement an Update Operation in the ApiService.
- •
Define the Domain Event
- •Create a
recordinsrc/BookStore.ApiService/Events/ - •Naming:
{Resource}Updatedor specific action (e.g.,BookPublished) - •Template:
templates/Event.cs
- •Create a
- •
Define the Command
- •Create a
recordinsrc/BookStore.ApiService/Commands/{Resource}/ - •Naming:
{Verb}{Resource}(e.g.,UpdateAuthor,PublishBook) - •Template:
templates/Command.cs
- •Create a
- •
Implement the Endpoint
- •Create/Update
src/BookStore.ApiService/Endpoints/{Resource}Endpoints.cs - •Pattern: Wolverine.HTTP
- •Features: Use
[Aggregate]attribute to auto-load state. - •Logic: Pure function receiving
aggregateand returning(IResult, IEvent). - •Template:
templates/Endpoint.cs
- •Create/Update
- •
Update Read Models
- •Ensure your projections handle the events.
Related Skills
- •
/scaffold-create-operation: For creating new resources. - •
/scaffold-delete-operation: For deleting resources.