本文整理汇总了C#中FubuTransportation.Runtime.Envelope.Clone方法的典型用法代码示例。如果您正苦于以下问题:C# Envelope.Clone方法的具体用法?C# Envelope.Clone怎么用?C# Envelope.Clone使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FubuTransportation.Runtime.Envelope
的用法示例。
在下文中一共展示了Envelope.Clone方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: cloning_an_envelope
public void cloning_an_envelope()
{
var envelope = new Envelope();
envelope.Message = new Message1();
envelope.Headers["a"] = "1";
envelope.Headers["b"] = "2";
var clone = envelope.Clone();
clone.ShouldNotBeTheSameAs(envelope);
clone.Message.ShouldBeTheSameAs(envelope.Message);
clone.Headers.ShouldNotBeTheSameAs(envelope.Headers);
clone.Headers["a"].ShouldEqual("1");
clone.Headers["b"].ShouldEqual("2");
}
示例2: Send
// virtual for testing of course
public virtual IHeaders Send(Envelope envelope, IEnvelopeSerializer serializer, Uri replyUri = null)
{
var clone = envelope.Clone();
// Must be done in this order!
Modifiers.Each(x => x.Modify(clone));
serializer.Serialize(clone, this);
clone.Headers[Envelope.DestinationKey] = Uri.ToString();
clone.Headers[Envelope.ChannelKey] = Key;
if (replyUri != null)
{
clone.Headers[Envelope.ReplyUriKey] = replyUri.ToString();
}
Channel.Send(clone.Data, clone.Headers);
return clone.Headers;
}