닷넷 코어의 구성을 주입 ... 내가 기본 클래스에서 내 클래스 DBActivityRepository에 연결 문자열을 주입하고 싶습니다의존성 삽입 (Dependency Injection) : I 닷넷 코어 2.0에 오래된 소프트웨어를 마이그레이션하고있어 2.0
. ..
난 그냥 기본 클래스
this._DBHandler = new DBHandler(configuration);
의 창조의 구성을 통과해야 또는 그것을 이런 식으로 수행하는 것이 좋습니다 :
private DBHandler _DBHandler;
private string connectionString;
public DBActivityRepository(IConfiguration configuration) : base(configuration)
{
// **Do I need this?**
this._DBHandler = new DBHandler(configuration);
connectionString = this._DBHandler.GetConnectionString();
}
을
감사합니다.
https://www.codeproject.com/Articles/1204089/ASP-NET-Core-Dependency-Injection – Ramankingdom
https://docs.microsoft.com/en-us/aspnet/core/fundamentals/ 의존성 주입 – Ramankingdom