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;
}