I am working on an N-Layered .NET application with the following layers:
- Presentation
- Application
- Domain
- Infrastructure (Contains Persistence and common utility functions like email)
At some point in my application, a request is approved. Once approved, there are 4 steps which must be performed as follows:
- Assign a product tag code to the issued product in the Request.
- Update the Request status from “Being Processed” to “Order Completed”
- Send an email to the requester stating their product is ready for pickup
- Send an email to the requester’s manager informing them of what their employee has been given and a copy of the request they approved for the product
The above steps must be part of an atomic operation meaning they must all be done or the action is cancelled. I am thinking of having the Application Layer directing the Request Repository and Persistence Layer to carry out the tasks as follows:
- Application Layer requests for the Request Repository to perform steps 1 and 2 as a unit of work transaction
- Application Layer requests for the Infrastructure layer to carry out steps 3 and 4.
I'm not exactly sure if the Application Layer is supposed to do this. I think it is because the first 2 actions require contacting a repository which I have avoided doing in the Domain Layer. The last 2 steps involve the Infrastructure Layer which the domain layer may talk to via a dependency injected instance. Following this logic, the Application Layer is not asking the Domain Layer to do anything. Is this typically how it is for a multi-step process like this when you have an Application Layer? Or did I miss something here?
I am aware of a framework called Windows Workflow but I'm not sure if that would help in this case as this multi-step process does not involve human interaction along the processing steps where things could be waiting for a few days. I also don't want to make the application overly complex if I don't have to.
Thanks in advance.