示例#1
0
 protected override void Dispose(bool disposing)
 {
     if (disposing)
     {
         db.Dispose();
     }
     base.Dispose(disposing);
 }
        public void Setup()
        {
            if (_context.GetStatus() != Status.Uninitialized)
            {
                _context.Dispose();
            }

            Assert.AreEqual(Status.Uninitialized, _context.GetStatus());
        }
示例#3
0
 public virtual void Dispose(bool disposing)
 {
     if (!this.disposed)
     {
         if (disposing)
         {
             db.Dispose();
         }
         this.disposed = true;
     }
 }
        public static void DestroyScope()
        {
            List <IDisposable> services = null;
            WorkerContext      context  = null;

            if (TransientServices.TryRemove(WorkerContext.ContextIdentifier, out services))
            {
                foreach (var item in services)
                {
                    if (item != null)
                    {
                        item.Dispose();
                    }
                }
            }
            if (TransientContexts.TryRemove(WorkerContext.ContextIdentifier, out context))
            {
                context.Dispose();
            }
        }