dheeraj gupta

dheeraj gupta

  • NA
  • 91
  • 26.5k

Reading connection string in class library dotnet core

Dec 24 2019 12:06 PM
Hi,
 
I have a solution in which there are 2 projects
 
1. DotNet Core API 2.2
2. DotNet Core Class library
 
There is a connection string defined in appsettings json file in api project. I want to read that connection string in class library project via dependency injection and return connection object.
 
I have tried different approaches to resolve but nothing seems to be working for me.
 
Can anyone explain or suggest a detailed example which can be reference point to implement the same.
 
Thanks in advance.
 
Thanks
Dheeraj 

Answers (1)