Fast, Efficient Message Archiving for BizTalk with the BizTalk Message Archiving Pipeline Component. Download a Free 14-Day Trial!

Using Context.Write to *Update* a Context Property Value

Originally posted by Nick Heppleston at: http://www.modhul.com/2009/03/05/using-contextwrite-to-update-a-context-property-value/

This one has been done to death, but I am writing a moniker replacement pipeline component and noticed some interesting behaviour when looking to update Context Properties.

If you need to update an existing Context Property value, there is no Update() method defined in the IBaseMessageContext interface. However it is possible to write your new value which will perform an update. So use the following code to update the value in an existing Context Property:

private void WriteContextPropertyValue(IBaseMessage msg, string propName, string propNamespace, string propValue)
{
    message.Context.Write(propertyName, propertyNamespace, propertyValue);
}

Using the above code in an NUnit test, we can see that our original SOAP moniker is updated with the correct HTTP moniker with little more than a Context Property write.

contextpropertyupdateoutput

0 Responses to “Using Context.Write to *Update* a Context Property Value”


  1. No Comments

Leave a Reply





Get Adobe Flash playerPlugin by wpburn.com wordpress themes

Nick Heppleston’s BizTalk Blog is Digg proof thanks to caching by WP Super Cache