Spring.NET 1.3.0 RC1 for .NET 2.0 API Reference

HibernateAccessor.AlwaysUseNewSession Property

Gets or sets a value indicating whether to always use a new Hibernate Session for this template.

[Visual Basic]
Public MustOverride Property AlwaysUseNewSession() As Boolean
   Public Get
   End Get
   Public Set
   End Set
End Property
public abstract bool AlwaysUseNewSession { public get; public set; }

Property Value

true if always use new session; otherwise, false.


Default is "false"; if activated, all operations on this template will work on a new NHibernate ISession even in case of a pre-bound ISession (for example, within a transaction).

Within a transaction, a new NHibernate ISession used by this template will participate in the transaction through using the same ADO.NET Connection. In such a scenario, multiple Sessions will participate in the same database transaction.

Turn this on for operations that are supposed to always execute independently, without side effects caused by a shared NHibernate ISession.

See Also

HibernateAccessor Class | Spring.Data.NHibernate Namespace