Creates a new instance every time it’s requested.
Best suited for lightweight, stateless services.
🔹 Scoped
One instance per request.
Shared only within the same user operation.
🔹 Singleton
A single instance for the entire application lifetime.
Shared by all users and must be thread-safe.
Rule of thumb:
Stateless → Transient
Per request → Scoped
Global shared → Singleton


0 comments:
Post a Comment
Note: only a member of this blog may post a comment.