手动初始化类时如何进行构造函数注入?
public class ApiKeyHandler : DelegatingHandler
{
private IApiService apiService;
public ApiKeyHandler(IApiService apiService)
{
this.apiService = apiService;
}
}
初始化:
var apiKey = new ApiKeyHandler(/*inject here */);
我该如何做到这一点?我的绑定和一切都已经设置好了。