Ejemplo n.º 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();
     }
 }
Ejemplo n.º 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;
 }
Ejemplo n.º 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;
     }
 }
Ejemplo n.º 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;
            }
        }
Ejemplo n.º 7
0
 public override void TestFixtureTearDown()
 {
     disposableSet.DisposeSafely();
     base.TestFixtureTearDown();
 }
Ejemplo n.º 8
0
 public virtual void TestFixtureTearDown()
 {
     disposables.DisposeSafely(true);
     Domain.DisposeSafely(true);
 }
Ejemplo n.º 9
0
 public void Dispose()
 {
     reader.DisposeSafely();
     resources.DisposeSafely();
     underlyingCommand.DisposeSafely();
 }