Thanks for the tip! I'm already ensuring that things get cleaned up
correctly, but ConditionalWeakTable seems to better fit this use case, I
didn't know about it.

Would this feature be something worth adding to NH? Maybe even disposing
IDisposable items on session dispose. Would you accept a PR?


El dom., 16 de dic. de 2018 a la(s) 12:16, Gunnar Liljas (
[email protected]) escribió:

> Hi,
>
> There are indeed cases where such a thing would be nice, but currently
> there is no such thing. What you're already doing is probably the best
> workaround, but I would use WeakReferences or a ConditionalWeakTable,
> so that the dictionary doesn't hold references to discarded sessions.
>
> /G
>
> Den sön 16 dec. 2018 kl 15:42 skrev Germán Schuager <[email protected]>:
> >
> > Hi, I often have the requirement to store session related stuff known at
> session creation that need to be used at some other point in time (for
> example in event listeners, which are singletons).
> > I solved this case in some places using basically a Dictionary<ISession,
> SessionContext> (SessionContext is another dictionary), but always thought
> that it would be very useful if ISession would already contain an Items bag
> for example... is there anything like that?
> >
> > --
> > You received this message because you are subscribed to the Google
> Groups "nhusers" group.
> > To unsubscribe from this group and stop receiving emails from it, send
> an email to [email protected].
> > To post to this group, send email to [email protected].
> > Visit this group at https://groups.google.com/group/nhusers.
> > For more options, visit https://groups.google.com/d/optout.
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "nhusers" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/nhusers/fySOrgnCynU/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> [email protected].
> To post to this group, send email to [email protected].
> Visit this group at https://groups.google.com/group/nhusers.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/nhusers.
For more options, visit https://groups.google.com/d/optout.

Reply via email to