0

I have a model class modeled after what I am trying to access in appsettings and in startup I have

 services.Configure<User>(Configuration.GetSection("Settings"));

my question is how can I access it in another class without needing DI or to have a constructor for that class, the reason I ask is because I already have a constructor

  • That's a form of the Service Locator Anti-pattern. If you have a dependency, pass it in as a parameter via the constructor. – David L Nov 05 '20 at 18:13
  • possible duplicate of https://stackoverflow.com/questions/41772001/access-to-configuration-without-dependency-injection ? – Dot Net developer Nov 05 '20 at 18:14

0 Answers0