My application includes the Presentation Layer Project which is the Web-server's project.
In the Startup class of the PL I add a singleton service of type IServiceFacade. The controllers will be injected with it and use it to speak with the lower Service Layer Project functionality (PL Project holds a reference to the ServiceLayer Project).
The ServiceFacade holds an object of type IBusinessLogicFacade and uses it to speak with the lower Business Layer Project (Service Layer Project holds a reference to the Business Logic Project).
I also use the .net Core built-in logging API to inject ILogger to the controllers, the ServiceFacade and the BusinessLogicFacade, this only requires a reference to Microsoft.Extensions.Logging.
Like I added the ServiceFacade as a service, thus enabling the injection, I would like to add the BusinessLogicFacade as a service, But this will require a reference from the PL Project to the Business Logic Project, breaking the layer separation.
I could create the BusinessLogicFacade "manually" in the ServiceFacade, but I will then need to supply an ILogger too, because I cannot use the injection of it when creating the BusinessLogicFacade manually.
services.AddSingleton<IServiceFacade,ServiceFacade> (OK, PL holds a reference to ServiceLayer Project)
services.AddSingleton<IBusinessLogicFacade,BusinessLogicFacade> (Not OK, Requires a reference from PL to BL).
Is there a way to receive the some parameters (as the ILogger) through injection when "manually" creating an object? How should I approach this problem?