Using dependency injection in a non-controller class?
问题 I have a DocumentRenderer class, which calls an external API. The DocumentRenderer requires an AccessKey, which is stored in my appsettings.json config file. I want a newly instantiated DocumentRenderer object to, by default, use the AccessKey specified in the config file. However, I can't figure out how to achieve this outside of startup.cs. (I'm using ASP.NET Core) Here's what I've tried so far: Added DocumentRenderer to appsettings.json: "DocumentRenderer": { "AccessKey": "<key>",