Пример #1
0
        internal static void Trace(this HttpResponseMessage response)
        {
            VssRequestTimerTrace tracer = null;

            if (response.RequestMessage.Options.TryGetValue(tracerKey, out object tracerObj))
            {
                tracer = tracerObj as VssRequestTimerTrace;
                Debug.Assert(tracer != null, "Tracer object is the wrong type!");
            }

            if (tracer != null)
            {
                tracer.TraceResponse(response);
            }
        }
Пример #2
0
        internal static void Trace(this HttpRequestMessage request)
        {
            VssRequestTimerTrace tracer;

            if (request.Options.TryGetValue(tracerKey, out object tracerObj))
            {
                tracer = tracerObj as VssRequestTimerTrace;
                Debug.Assert(tracer != null, "Tracer object is the wrong type!");
            }
            else
            {
                tracer = new VssRequestTimerTrace();
                request.Options.Set(new HttpRequestOptionsKey <VssRequestTimerTrace>(tracerKey), tracer);
            }

            if (tracer != null)
            {
                tracer.TraceRequest(request);
            }
        }
        internal static void Trace(this HttpRequestMessage request)
        {
            Object tracerObj            = null;
            VssRequestTimerTrace tracer = null;

            if (request.Properties.TryGetValue(tracerKey, out tracerObj))
            {
                tracer = tracerObj as VssRequestTimerTrace;
                Debug.Assert(tracer != null, "Tracer object is the wrong type!");
            }
            else
            {
                tracer = new VssRequestTimerTrace();
                request.Properties[tracerKey] = tracer;
            }

            if (tracer != null)
            {
                tracer.TraceRequest(request);
            }
        }