I'm trying to create singleton class but only for session. So I want to have one instance for each user that enters website (it's for JMS server). Therefore - when session will be closed I have to invoke close connection from library.
So:
- how to create class that will be one for each session?
- how to catch event that session is not inactive and invoke some method?
Tried with AddSingleton/AddTransient/AddScoped but probably it's not proper way for the job (or I'm using it wrong).
To explain more - "Business Case" is web application, where user can check messages on queues on JMS server. User enters connection parameters on welcome page (login) - so when somebody uses app (and is connected to some JMS server), another User can enter page - see login and this another user creates his own connection to another JMS server.
If you're sure you want them per session, you might consider creating instances on session creation using: