示例#1
0
 public void EndContext(
     HttpContextBase context,
     string virtualPath,
     TextWriter writer,
     int startPosition,
     int length,
     bool isLiteral
     )
 {
     if (IsAvailable)
     {
         PageInstrumentationServiceAdapter instrumentationService =
             GetInstrumentationService(context);
         if (
             instrumentationService != null &&
             instrumentationService.ExecutionListeners.Count > 0
             )
         {
             var instrumentationContext = CreateContext(
                 virtualPath,
                 writer,
                 startPosition,
                 length,
                 isLiteral
                 );
             foreach (
                 PageExecutionListenerAdapter listener in instrumentationService.ExecutionListeners
                 )
             {
                 listener.EndContext(instrumentationContext);
             }
         }
     }
 }
示例#2
0
        private PageInstrumentationServiceAdapter GetInstrumentationService(HttpContextBase context)
        {
            // There seems to be the potential for the adapter to be null.
            if (!_isInstrumentationServiceAdapterInitialized)
            {
                _instrumentationServiceAdapter = ExtractInstrumentationService(context);

                _isInstrumentationServiceAdapterInitialized = true;
            }

            return(_instrumentationServiceAdapter);
        }
        private PageInstrumentationServiceAdapter GetInstrumentationService(HttpContextBase context)
        {
            // There seems to be the potential for the adapter to be null.
            if (!_isInstrumentationServiceAdapterInitialized)
            {
                _instrumentationServiceAdapter = ExtractInstrumentationService(context);

                _isInstrumentationServiceAdapterInitialized = true;
            }

            return _instrumentationServiceAdapter;
        }
示例#4
0
 private void RunOnListeners(HttpContextBase context, Action <PageExecutionListenerAdapter> act)
 {
     if (IsAvailable)
     {
         PageInstrumentationServiceAdapter instSvc = ExtractInstrumentationService(context);
         if (instSvc != null)
         {
             foreach (PageExecutionListenerAdapter listener in instSvc.ExecutionListeners)
             {
                 act(listener);
             }
         }
     }
 }