.NET Core multi-tier app: Where to store config json file and access it from different projects?

57 Views Asked by At

I have a .NET Core solution with 3 projects: MVC app, data access layer (class library that contains Entity Framework context and models) and business layer (class library). In the MVC project, there is a config json file with values like connection string and resources paths etc.

But what if I need to have, besides the MVC project, another project or projects for different client apps (for example, a REST API and/or desktop app), that needs to use the same database and resource paths? I guess i could just create a json file in each of these projects and manually keep them in-sync to have the same values, but is this the correct way of doing this?

1

There are 1 best solutions below

0
Hassan Arafat On

You would need to have the appSettings file just in the root folder of your ASP.NET (Core) MVC project. All projects will read from these AppSettings