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

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?

3 Related questions 5 Connection String in app.config of a dll 176 How to read connection string in .NET Core? 8 Get connection string in .NET Core application Related questions 5 Connection String in app.config of a dll 176 How to read connection string in .NET Core? 8 Get connection string in .NET Core application 0 read connectionstring from WebConfig file in dll 3 How to get ConnectionString in a ClassLibrary? 6 How to read connection string inside .NET Standard Class library project from ASP.NET Core 5 .NET Core: How can I set the connection string? 1 Global ConnectionString in .net Core WebApi 5 How to retrieve connection string in class from .NET Core 2.1 Web API w/o Entity Framework 1 How do I get a connection string in a .net core standard class library from the configuration file in a .net core 2.0 web app? Load 7 more related questions Show fewer related questions Reset to default

Know someone who can answer? Share a link to this question via email, Twitter, or Facebook.

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

You Might Also Like