Follow this guide to implement a Create Operation (Start Stream) in the ApiService.
- •
Define the Domain Event
- •Create a
recordinsrc/BookStore.ApiService/Events/ - •Naming:
{Resource}Created - •Template:
templates/Event.cs
- •Create a
- •
Define the Command
- •Create a
recordinsrc/BookStore.ApiService/Commands/{Resource}/ - •Naming:
Create{Resource} - •Template:
templates/Command.cs
- •Create a
- •
Implement the Endpoint
- •Create/Update
src/BookStore.ApiService/Endpoints/{Resource}Endpoints.cs - •Pattern: Wolverine.HTTP
- •Logic: Pure function returning
(IResult, StartStream<T>) - •Template:
templates/Endpoint.cs
- •Create/Update
- •
Update Read Models
- •Ensure your projections handle the
{Resource}Createdevent.
- •Ensure your projections handle the
Related Skills
- •
/scaffold-update-operation: For updating existing resources. - •
/scaffold-delete-operation: For deleting resources.