Dotnet 6 Dependency Injection
종속성 클래스와 해당 종속성 간의 Ioc (Inversion of Control)를 실현하는 기술로 DI (Dependency Injection) 라는 디자인 패턴을 지원한다. 종류 (서비스 수명) Transient : 요청할 때마다 만들어 짐, 요청이 끝날때 삭제 ex) AddTransient, TryAddTransient Scoped : 특정 범위( HTTP 요청 당 하나의 인스턴스를 생성)에서 요청할때마다 만들어짐, 요청이 끝날때 삭제 ex) AddScoped, TryAddScoped Singleton : 처음 요청될때 한번 만들어짐 ex) AddSingleton, TryAddSingleton 예제) public interface IMyDependency { void WriteMessage(stri..
2022.01.01