Skip to content

Session Middleware Transient Session Store #48807

Closed Answered by gfoidl
richarddrum asked this question in Q&A
Discussion options

You must be logged in to vote

Is the transient session store essentially being used as a singleton since the session middleware that uses it is a singleton?

Yes.

It's registered as transient, because if any other code would require an ISessionStore so that another instance is returned.
If that registration would be as singleton, than the same instance is returned, which may lead to overriding the content in the store. So to prevent latent and hard to diagnose bugs, it's registered as transient.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by richarddrum
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
2 participants