We always set the result to use a thread static variable, on the face of it, it looks like it is not a valid choice, since ASP.Net and WCF may decide to switch threads on us. But, since SessionIdLoggingContext is only used inside NH calls, and since NH calls are never async, this isn't an issue for us. In addition to that, attempting to match to the current context has proven to be performance hit.

Namespace: NHibernate.Impl
Assembly: NHibernate (in NHibernate.dll) Version: 3.2.0.4000 (3.2.0.4000)

Syntax

C#
public static Nullable<Guid> SessionId { get; set; }
Visual Basic
Public Shared Property SessionId As Nullable(Of Guid)
	Get
	Set
Visual C++
public:
static property Nullable<Guid> SessionId {
	Nullable<Guid> get ();
	void set (Nullable<Guid> value);
}

See Also