예제 #1
0
        // 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();
     }
 }
예제 #3
0
 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;
 }
예제 #5
0
 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;
     }
 }
예제 #6
0
        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;
            }
        }
예제 #7
0
 public override void TestFixtureTearDown()
 {
     disposableSet.DisposeSafely();
     base.TestFixtureTearDown();
 }
예제 #8
0
 public virtual void TestFixtureTearDown()
 {
     disposables.DisposeSafely(true);
     Domain.DisposeSafely(true);
 }
예제 #9
0
 public void Dispose()
 {
     reader.DisposeSafely();
     resources.DisposeSafely();
     underlyingCommand.DisposeSafely();
 }