Reputation: 877
Background
I have an existing project ("Project A") which has config files set up as JSON
files. It was implemented with Microsoft.Extensions.Configuration.Json
package.
This existing project has a lot of useful functions and I do not want to rebuild them in my new project("Project B"). Hence I tried to add Project A to Project B as DLL file.
Problem
After adding the reference, it seems the configuration setup in Project B has become difficult to handle, things like DB connections etc. Those were configured in Project A and passed into functions in Project A using dependency injection. Basically the DLL does not read the configuration of Project B even though I tried the exactly same Json file structure.
Question
Is it recommended at all to add reference of Project A into Project B as DLL?
If yes, then how should I handle configurations like DB connections, and other parameters which Project A requires?
Upvotes: 0
Views: 47
Reputation: 17
Probably best to extend "Project A" and have things like your DB connection in "Project B" ported into "Project A". It seems like right now the system is checking the config in "Project A" only.
Upvotes: 1