コード例 #1
0
 /// <summary>
 /// Logs a transfer to a new ActivityId (and uses the <see cref="RelatedActivityIdStore"/> to store the
 /// relatedActivityId in <see cref="CallContext"/> for the duration of the call)
 /// </summary>
 /// <param name="eventCache">A cache of data that defines the trace event</param>
 /// <param name="source">The trace source</param>
 /// <param name="id">The unique ID of the trace event</param>
 /// <param name="message">A message to be output regarding the trace event</param>
 /// <param name="relatedActivityId">The activityId to which we are transferring</param>
 public override void TraceTransfer(TraceEventCache eventCache, string source, int id, string message,
                                    Guid relatedActivityId)
 {
     //TODO: I don't think this code is right here - as this inserts a related activity ID, and then
     // promptly removes it again on dispose()
     using (RelatedActivityIdStore.SetRelatedActivityId(relatedActivityId))
     {
         base.TraceTransfer(eventCache, source, id, message, relatedActivityId);
     }
 }
コード例 #2
0
        /// <summary>
        /// Lookup the RelatedActivityIdStore
        /// </summary>
        /// <param name="value">The value of the RelatedActivityId property if it is defined, or null</param>
        /// <param name="cache">Unused</param>
        /// <param name="source">Unused</param>
        /// <param name="eventType">Unused</param>
        /// <param name="id">Unused</param>
        /// <param name="formatOrMessage">Unused</param>
        /// <param name="data">Unused</param>
        /// <returns>Trus if there is a Guid in the RelatedActivityId store</returns>
        public override bool TryGetValue(out object value, TraceEventCache cache, string source,
                                         TraceEventType eventType, int id, string formatOrMessage,
                                         object[] data)
        {
            Guid relatedActivityId;
            bool response = RelatedActivityIdStore.TryGetRelatedActivityId(out relatedActivityId);

            value = relatedActivityId;
            return(response);
        }