C# 클래스 UCDArch.Data.NHibernate.NHibernateSessionManager

Handles creation and management of sessions and transactions. It is a singleton because building the initial session factory is very expensive. Inspiration for this class came from Chapter 8 of Hibernate in Action by Bauer and King. Although it is a sealed singleton you can use TypeMock (http://www.typemock.com) for more flexible testing.
파일 보기 프로젝트 열기: ucdavis/UCDArch

Private Properties

프로퍼티 타입 설명
GetSession ISession
InitSessionFactory void
IsInWebContext bool
NHibernateSessionManager System.Runtime.Remoting.Messaging

공개 메소드들

메소드 설명
BeginTransaction ( ) : void
CloseSession ( ) : void
CommitTransaction ( ) : void
EnsureFreshness ( object o ) : void

Make sure the object given is connected to the current session

GetSession ( ) : ISession

Shortcut which just calls into the GetSession overload with the current registered interceptor. If no interceptor has been registered, it will be null

HasOpenTransaction ( ) : bool
RegisterInterceptor ( IInterceptor interceptor ) : void

Allows you to set the interceptor which will be used in all subsequent sessions

RollbackTransaction ( ) : void
SetFlushMode ( FlushMode flushMode ) : void

Allows you to set the flush mode which will be used with all sessions

비공개 메소드들

메소드 설명
GetSession ( IInterceptor interceptor ) : ISession

Gets a session with or without an interceptor. This method is not called directly; instead, it gets invoked from other public methods.

InitSessionFactory ( ) : void
IsInWebContext ( ) : bool
NHibernateSessionManager ( ) : System.Runtime.Remoting.Messaging

Initializes the NHibernate session factory upon instantiation.

메소드 상세

BeginTransaction() 공개 메소드

public BeginTransaction ( ) : void
리턴 void

CloseSession() 공개 메소드

public CloseSession ( ) : void
리턴 void

CommitTransaction() 공개 메소드

public CommitTransaction ( ) : void
리턴 void

EnsureFreshness() 공개 메소드

Make sure the object given is connected to the current session
public EnsureFreshness ( object o ) : void
o object Mapped Object
리턴 void

GetSession() 공개 메소드

Shortcut which just calls into the GetSession overload with the current registered interceptor. If no interceptor has been registered, it will be null
public GetSession ( ) : ISession
리턴 ISession

HasOpenTransaction() 공개 메소드

public HasOpenTransaction ( ) : bool
리턴 bool

RegisterInterceptor() 공개 메소드

Allows you to set the interceptor which will be used in all subsequent sessions
public RegisterInterceptor ( IInterceptor interceptor ) : void
interceptor IInterceptor
리턴 void

RollbackTransaction() 공개 메소드

public RollbackTransaction ( ) : void
리턴 void

SetFlushMode() 공개 메소드

Allows you to set the flush mode which will be used with all sessions
public SetFlushMode ( FlushMode flushMode ) : void
flushMode FlushMode
리턴 void