示例#1
0
        internal static MessageContext Enter(string returnAddress)
        {
            if (current != null)
            {
#if DEBUG
                throw new InvalidOperationException(
                    string.Format(
                        @"Cannot establish new message context when one is already present!

Stacktrace of when the current message context was created:
{0}",
                        current.StackTrace));
#else
                throw new InvalidOperationException(
                    string.Format("Cannot establish new message context when one is already present"));
#endif

            }
            current = new MessageContext
                          {
                              ReturnAddress = returnAddress
                          };

            Established(current);

            return current;
        }
示例#2
0
        internal static MessageContext Enter(IDictionary<string, string> headers)
        {
            if (current != null)
            {
#if DEBUG
                throw new InvalidOperationException(
                    string.Format(
                        @"Cannot establish new message context when one is already present!

Stacktrace of when the current message context was created:
{0}",
                        current.StackTrace));
#else
                throw new InvalidOperationException(
                    string.Format("Cannot establish new message context when one is already present"));
#endif

            }
            var messageContext = new MessageContext(headers);

            current = messageContext;

            Established(current);

            return messageContext;
        }
示例#3
0
 public void Dispose()
 {
     current = null;
     
     Disposed();
 }
示例#4
0
 public void Dispose()
 {
     current = null;
 }
示例#5
0
 internal static MessageContext Establish(IDictionary<string, object> headers)
 {
     var messageContext = new MessageContext(headers);
     Establish(messageContext, overwrite: false);
     return messageContext;
 }