IEnumerable <KeyValuePair <string, string> > GetMessageHeaderValues(IMessageTraceDetail detail) { if (detail.MessageId.IsNotEmpty()) { yield return(new KeyValuePair <string, string>("Message Id", detail.MessageId)); } if (detail.SourceAddress != null) { yield return(new KeyValuePair <string, string>("Source Address", detail.SourceAddress.ToString())); } if (detail.InputAddress != null) { yield return(new KeyValuePair <string, string>("Input Address", detail.InputAddress.ToString())); } if (detail.DestinationAddress != null) { yield return(new KeyValuePair <string, string>("Destination Address", detail.DestinationAddress.ToString())); } if (detail.ResponseAddress != null) { yield return(new KeyValuePair <string, string>("Response Address", detail.ResponseAddress.ToString())); } if (detail.FaultAddress != null) { yield return(new KeyValuePair <string, string>("Fault Address", detail.FaultAddress.ToString())); } if (detail.Network.IsNotEmpty()) { yield return(new KeyValuePair <string, string>("Network", detail.Network)); } if (detail.ContentType.IsNotEmpty()) { yield return(new KeyValuePair <string, string>("Content Type", detail.ContentType)); } if (detail.MessageType.IsNotEmpty()) { yield return(new KeyValuePair <string, string>("Message Type", detail.MessageType)); } if (detail.ExpirationTime.HasValue) { yield return (new KeyValuePair <string, string>("Expiration Time", detail.ExpirationTime.Value.ToString("yyyy-MM-dd hh:mm:ss.ffff"))); } if (detail.RetryCount != 0) { yield return(new KeyValuePair <string, string>("Retry Count", detail.RetryCount.ToString())); } }
IDictionary <string, string> GetMessageHeaderDictionary(IMessageTraceDetail detail) { return(GetMessageHeaderValues(detail).ToDictionary(x => x.Key, x => x.Value)); }