Пример #1
0
 /// <summary>
 /// Disposes any cached <see cref="SqlConnection"/>.
 /// This <see cref="SqlStandardCallContext"/> instance can be reused once disposed.
 /// </summary>
 public virtual void Dispose()
 {
     if (_cache != null)
     {
         Controller c = _cache as Controller;
         if (c != null)
         {
             c.DisposeConnection();
         }
         else
         {
             Controller[] cache = _cache as Controller[];
             for (int i = 0; i < cache.Length; ++i)
             {
                 cache[i].DisposeConnection();
             }
         }
         _cache = null;
         if (_monitor != null && _ownedMonitor)
         {
             _monitor.MonitorEnd();
             _monitor = null;
         }
     }
 }
Пример #2
0
 public Task StopAsync(CancellationToken stoppingToken)
 {
     // MonitorEnd is a way to tell the system: "I won't use this monitor anymore".
     // It tells tools that past this point, this monitor can safely be forgotten and no more
     // logs should be sent through it.
     // But this is just a hint: ending a monitor like this is absolutely not a requirement.
     _monitor.MonitorEnd("LoggerTestHostedService stopped.");
     _timer.Change(Timeout.Infinite, 0);
     return(Task.CompletedTask);
 }
Пример #3
0
 static void DefaultOnEndRequest(HttpContext ctx, IActivityMonitor m, TaskStatus status)
 {
     m.MonitorEnd();
 }