Exemplo n.º 1
0
        public void Dispose(bool isDisposing)
        {
            if (isDisposing)
            {
                this.Close();

                if (this._transaction != null)
                {
                    this._transaction.Dispose();
                    this._transaction = null;
                }

                if (this._session != null)
                {
                    this._session.Dispose();
                    this._session = null;
                }

                this._interceptor = null;

                if (System.Threading.Thread.GetData(_localDataStoreSlot) == this)
                {
                    System.Threading.Thread.SetData(_localDataStoreSlot, null);
                }
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Initialized a new instance of the Repository class.
        /// 构造函数:创建Repository类实例,并传递ISession实例和IInterceptor实例
        /// </summary>
        /// <param name="session">An instance of NHibernate.ISession that
        /// will be used as the default session by the gateway.</param>
        /// <remarks>
        /// <param name="interceptor">An instance of IInterceptor used to
        /// provide persistence pipeline processing on all persistent
        /// objects pass through it.</param>
        public Repository(NHibernate.ISession session, NHibernate.IInterceptor interceptor)
        {
            if (!Repository.GetIsOpen(session))
            {
                throw new Exception(String.Format("A {0} can only be constructed with an open session.", this.GetType().ToString()));
            }

            this._session     = session;
            this._interceptor = interceptor;
        }
Exemplo n.º 3
0
 /// <summary>
 /// Initialized a new instance of the Repository class.
 /// 构造函数:创建Repository类实例,并传递IInterceptor实例
 /// </summary>
 /// <param name="interceptor">An instance of IInterceptor used to
 /// provide persistence pipeline processing on all persistent
 /// objects pass through it.</param>
 public Repository(NHibernate.IInterceptor interceptor)
     : this()
 {
     this._interceptor = interceptor;
 }