Implementing actors in an e-commerce reservation system
Equipped with information about the actor’s pattern and with a plan to implement the evolution of our sample project by introducing Dapr actors, we now have several steps to complete, as follows:
- Preparing the actor’s projects
- Implementing the actor’s model
- Accessing actors from other Dapr applications
- Inspecting the actor’s state
Let’s start by creating the .NET projects.
Preparing the Actor’s projects
To implement actors with Dapr in C#, we must create an actor interface project that’s separate from the actor’s service implementation in two different projects.
The actor’s interface will be referenced by the other services or clients that need to interact with the actors. Let’s create the interface project, as follows:
PS C:\Repos\dapr-samples\chapter07> dotnet new classlib -o sample.microservice.reservationitemactor...