我们可以像这样将IConfiguration注入到类中:
//Controller
AppSettings obj = new AppSettings(_configuration);
//Class
public class AppSettings
{
private IConfiguration _configuration;
public AppSettings(IConfiguration configuration)
{
_configuration = configuration;
}
...
}
现在我正在尝试将IConfiguration注入到我的ActionFilter中。最好的方法是什么?