ASP.NET Core initialize singleton after configuring DI

后端 未结 3 715
渐次进展
渐次进展 2020-12-25 11:08

So let\'s say I have a singleton class instance that I register in the DI like this:

services.AddSingleton();

And let\'s s

3条回答
  •  北海茫月
    2020-12-25 11:23

    I got the same problem and I find Andrew Lock blog: https://andrewlock.net/running-async-tasks-on-app-startup-in-asp-net-core-3/

    He explains how to do this with asp .net core 3, but he also refers to his pages on how to to this with previous version.

提交回复
热议问题