❔ 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•2y ago
Message Not Public
Sign In & Join Server To View
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
Thank you very much 🙏
Looks like nothing has happened here. I will mark this as stale and this post will be archived until there is new activity.