NSoft.NFramework.Data.NHibernateEx.NHUnitOfWorkAdapter.Dispose C# (CSharp) Method

Dispose() protected method

Release resources
protected Dispose ( bool disposing ) : void
disposing bool release managed resources.
return void
        protected virtual void Dispose(bool disposing) {
            if(IsDisposed)
                return;

            if(disposing) {
                if(IsDebugEnabled)
                    log.Debug("Disposing NHUnitOfWorkAdapter instance...");

                Interlocked.Decrement(ref _usageCount);

                if(IsDebugEnabled)
                    log.Debug("Usage count of NHUnitOfWork : " + _usageCount);

                if(_usageCount != 0) {
                    if(IsDebugEnabled)
                        log.Debug("NHUnitOfWorkAdapter 사용 수가 0이 아니므로 Dispose 하지 않습니다.");

                    return;
                }

                if(_factory != null)
                    With.TryAction(() => _factory.DisposeUnitOfWork(this));

                if(_session != null)
                    With.TryAction(() => _session.Dispose());

                if(IsDebugEnabled)
                    log.Debug("Disposed NHUnitOfWorkAdapter instance!!!");
            }

            IsDisposed = true;
        }

Same methods

NHUnitOfWorkAdapter::Dispose ( ) : void