Exemplo n.º 1
0
        /// <summary>
        /// Dispose the TContext object that is associated to the current HTTP request
        /// </summary>
        /// <typeparam name="TContext"></typeparam>
        public static void DisposeContext <TContext>() where TContext : DbContext
        {
            string   contextName = typeof(TContext).Name;
            TContext dataContext = HttpContext.Current.Items[contextName] as TContext;

            if (dataContext != null)
            {
                dataContext.Dispose();
            }
        }
        protected virtual void Dispose(bool disposing)
        {
            if (!this.disposed)
            {
                if (disposing)
                {
                    _context.Dispose();
                }
            }

            this.disposed = true;
        }
Exemplo n.º 3
0
 // Dispose context when it is done
 public void Dispose() => context.Dispose();