ASP.NET Core initialize singleton after configuring DI
问题 So let's say I have a singleton class instance that I register in the DI like this: services.AddSingleton<IFoo, Foo>(); And let's say the Foo class has a number of other dependencies (mostly repository classes that allow it to load data). With my current understanding, the Foo instance is not created until it's first used (asked). Is there a way to initialize this class other than the constructor? Like right after ConfigureServices() completes? Or should the initialization code (loading data