BizTalk Server Tutorial

BizTalk Server Concepts and Common Errors

Difference between Message Context PropertyBase and Message Data PropertyBase.

This is one of the most commonly asked Question.

Every field in the property schema will be either of Type MessageContextPropertyBase and MessageDataPropertyBase (Default)

You would have already searched about the difference in MSDN which states, MessageDataPropertyBase should be selected, if the property value is filled by the Data within the Message and MessageContextPropertyBase should be selected, if the property is filled with the Data outside the Message.

So, what is the specific advantage of MessageContextPropertyBase?

Simple answer is, it helps us in preserving the Purity of the Message.

For eg: Assume that you process some Order Messages in your Application. During the Processing, you might encounter some error Messages.

Normally, developers add a new Element to the Order Schema and Try to fill that will Error Messages, which will then be used at later part of Orchestration.

But, this is not a good approach. Schema modifications should not be done for this kind of scenarios. Rather, MessageContextPropertyBase can be effectively used to hold the values associated with every message.

In short, MessageContextPropertyBase Element can be used to hold any kind of Metadata associated with the message which can be used to process the Message.

Sample Application: (To show how it can be used)

1. Create a Simple Schema.

2. Add a Property Schema with an Element and Set the Property Schema Base to MessageContextPropertyBase as shown below.

3. Create a Simple Orchestration. Add a Receive Shape to Receive the Message (say Message_1) of Type Schema which you created in Step 1.

4. Create a new Message (say Message_2) of the same Type Schema (created in step 1). Add a Message Assignment Shape. Set the Message Constructed to Message_2. Add the following Code.

Note: Modifying a Context Property is Considered as modifying a message and hence Message Assignment Shape should be used.

Now you created a message with a Custom Context Property. You can now use this message anywhere in the Orchestration as shown below.

This Message_2 can even be passed to any Sub Orchestrations and access the Context Property there.

This way MessageContextPropertyBase helps us in retaining the Purity of Message by keeping all the metadata associated with the message as Context Properties.

Points to Consider about MessageContextPropertyBase:

1. These are written to Message Context. They are not promoted. To promote them, you have to do in a Custom Pipeline or pass the message to a send port that Initializes/Follows Correlation with the Correlation Type Set to this Property.
2. Value can be written to this Property in any Pipeline Component using the Simple Method, InMessage.Context.Promote or InMessage.Context.Write

– Shiv

Web Counters



March 8, 2011 - Posted by | Schemas | , ,

3 Comments »

  1. […] context property base types (link 1) (link […]

    Pingback by BizTalk Readables | Better Take Notes | February 12, 2015 | Reply

  2. Very good explanation. Nothing to add.
    I’ve used MessageContextPropertyBase properties for message routing. The only disadvantage in this case is that you have to define Correlation Type Set to pass it to a send port.

    Comment by Michal | February 21, 2013 | Reply

  3. […] Message Data Property Base and Message Context Property Base would be clear to everyone (incase if you are not clear with the difference, you can refer this link). […]

    Pingback by Using PartContextPropertyBase in BizTalk Server « BizTalk Server Tutorial | June 6, 2011 | Reply


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: