// IDisposable implementation /// <summary> /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. /// </summary> public void Dispose() { if (isDisposed) { return; } try { OrmLog.Debug(Strings.LogSessionXDisposing, this); SystemEvents.NotifyDisposing(); Events.NotifyDisposing(); Services.DisposeSafely(); Handler.DisposeSafely(); CommandProcessorContextProvider.DisposeSafely(); Domain.ReleaseSingleConnection(); disposableSet.DisposeSafely(); disposableSet = null; EntityChangeRegistry.Clear(); EntitySetChangeRegistry.Clear(); EntityStateCache.Clear(); ReferenceFieldsChangesRegistry.Clear(); NonPairedReferencesRegistry.Clear(); } finally { isDisposed = true; } }
public void Dispose() { lock (resourcesSyncRoot) { resources.DisposeSafely(); temporaryResources.DisposeSafely(); } }
public void Dispose() { if (!isDisposed) { isDisposed = true; reader.DisposeSafely(); resources.DisposeSafely(); underlyingCommand.DisposeSafely(); } }
public virtual void TearDown() { disposables.DisposeSafely(); albums = null; artists = null; customers = null; employees = null; genres = null; invoices = null; invoiceLines = null; mediaTypes = null; playlists = null; tracks = null; }
protected void CreateSessionAndTransaction() { try { disposables = new DisposableSet(); var session = Domain.OpenSession(); disposables.Add(session); var transaction = session.OpenTransaction(); disposables.Add(transaction); } catch { disposables.DisposeSafely(); disposables = null; throw; } }
private async ValueTask DisposeImpl(bool isAsync) { if (isDisposed) { return; } sessionLifetimeToken.Expire(); try { if (IsDebugEventLoggingEnabled) { OrmLog.Debug(Strings.LogSessionXDisposing, this); } SystemEvents.NotifyDisposing(); Events.NotifyDisposing(); Services.DisposeSafely(); if (isAsync) { await Handler.DisposeSafelyAsync().ConfigureAwait(false); } else { Handler.DisposeSafely(); } CommandProcessorContextProvider.DisposeSafely(); Domain.ReleaseSingleConnection(); disposableSet.DisposeSafely(); disposableSet = null; EntityChangeRegistry.Clear(); EntitySetChangeRegistry.Clear(); EntityStateCache.Clear(); ReferenceFieldsChangesRegistry.Clear(); NonPairedReferencesRegistry.Clear(); Extensions.Clear(); } finally { isDisposed = true; } }
public override void TestFixtureTearDown() { disposableSet.DisposeSafely(); base.TestFixtureTearDown(); }
public virtual void TestFixtureTearDown() { disposables.DisposeSafely(true); Domain.DisposeSafely(true); }
public void Dispose() { reader.DisposeSafely(); resources.DisposeSafely(); underlyingCommand.DisposeSafely(); }