Job Scheduler Service
UI layer ->API Layer -> Application Layer
API Layer will dependent on Application Layer having interface Infrastructure layer will dependent on Application Layer via the interface.
The infrastructure layer and Application Layer will have the Domain Dependency.
And my Application Layer having CQRS with MediatR.
This is the way all the layers are linked.
I used hangfire to do the scheduling. So in the Core layer, I have a common class called JobExecutor which is implemented by using an interface IExecutor. Inside this, I am doing mediator to call the command. Which is a generic code. This interface is used by hangfire to schedule the commands.
Infrastructure.JobStorage Is the layer which is adding an entry to the hangfire database. This is done by calling hangfire.core.dll provided by hangfire. This Hangfire Library is using the Core interface IExecutor
So my question is it a best practice to pass the command which is present in the Application Layer to the Infrastructure Layer.
Let me know any more details.