public void Dispose()
 {
     if (RegisteredInstance == this)
     {
         RegisteredInstance = null;
         UnregisterAppDomainEvents();
         _logTimer?.Dispose();
         _traceSource.TraceInformation($"Unregistered interceptor {nameof(LazyLoadLoggingInterceptor)}");
     }
 }
        //private static LazyLoadLoggingInterceptor _registeredInstance;


        // ReSharper disable once MemberCanBePrivate.Global

        public LazyLoadLoggingInterceptor(int logFrequencyInMilliseconds, bool logDuringLazyLoad)
        {
            _logDuringLazyLoad = logDuringLazyLoad;
            if (logFrequencyInMilliseconds > 0) // allow turning off with any non-positive value
            {
                _logTimer = new Timer(_ => this.WriteAndResetTotals(), null, logFrequencyInMilliseconds, logFrequencyInMilliseconds);
            }
            if (RegisteredInstance == null)
            {
                RegisteredInstance = this;
                RegisterAppDomainEvents();
                _traceSource.TraceInformation($"Registered interceptor {nameof(LazyLoadLoggingInterceptor)}");
            }
        }