I have a question regarding the Nop.Core, Nop.Services and Nop.Data libraries used in Nopcommerce.
My understanding is that these libraries are software layers that sit beneath the presentation layer (since they are not in the presentation solution folder) and therefore should have no concern with presentation logic. Is my understanding correct?
I have been trying to create a console application (using the dependency injection setup from Nop.Web) and am running into the following dependency injection issues where the Nop libraries require knowledge of the web presentation layer:
1. An instance of IHostingEnvironment is required in Nop.Core/Infrastructure/NopFileProvider.cs and Nop.Services/Media/BaseRoxyFileman/BaseRoxyFilemanService.cs, DatabaseRoxyFilemanService.cs and FileRoxyFilemanService.cs.
IHostingEnvironment provides web hosting information such EnvironmentName, ApplicationName, WebRootPath, WebRootFileProvider, ContentRootPath and ContentRootFileProvider. The instance of IHostingEnviroment that Nop.Web uses is provided by the WebHost when Nop.Web/Program.Main() is called to start the application.
The NopFileProvider uses the IHostingEnvironment so that calls to MapPath(string path) can join the ContentRootPath to the path parameter.
Should the Nop.Core and Nop.Services have knowledge of the web server path?
2. An instance of IApplicationLifetime is required in Nop.Core/WebHelper.cs.
Microsoft.Extensions.Hosting.IApplicationLifetime is used in this class to stop the application in the RestartAppDomain() method.
Note: As a side note, this API is also now marked as obsolete.
Should the Nop.Core have knowledge of how to stop the web server?
So I am a little confused as to the responsibilities of these layers in this solution. I was hoping that I could just add the Nop.Core, Nop.Services and Nop.Data libraries to my console application but as these layers require knowledge of the web environment it is not as straightforward.
I can work around this in my console application, but my main concern is that if responsibilities are being ignored, that the architecture of NopCommerce does not go off track.
Does someone know if this is the case or is my understanding of the layer responsibilities incorrect.