How .DLL can access Connection string in .NET Core application?

Forums .NET CoreHow .DLL can access Connection string in .NET Core application?
Staff asked 2 years ago

I have one .Net Core Application, let’s say somethingSite in which I have included one Class Library Project, let’s say CommonActivity. In this Class Library project, I have referenced two DLLs, 1. BAL.dll and 2.DAL.dll.

Now when called make to BAL class say BusinessLayer, it will call the class DataAccessLayer available in DAL.dll. And this DataAccessLayer trying to access Connection String named “con”.

I have added the app.config file in my included Class Library (CommonActivity). But the issue is DAL is not able to Pick the Connection String “con” from App.config file and throwing an error “Object is not set to an instance”.

can anyone guide me what and where I am doing wrong here?

Subscribe

Select Categories