C
C#2y ago
Krai

❔ Singleton Pattern

Hi in ioc container we have .AddSingleton() method for singleton lifetimes. My question is when we need create a singleton class? Can't I just save it with dependency injection?
4 Replies
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
Pobiega
Pobiega2y ago
Singleton pattern instances should generally be avoided, and if you are using DI then there is no need to explicitly implement singleton pattern instances yourself. since you can just use .AddSingleton and be happy :p
Krai
KraiOP2y ago
Thank you very much 🙏
Accord
Accord2y ago
Looks like nothing has happened here. I will mark this as stale and this post will be archived until there is new activity.
Want results from more Discord servers?
Add your server