When adding a property schema that can either be used for content-based routing (CBR) or just to hold metadata information about a message in BizTalk we are confronted which Property Schema Base to use:
1. MessageDataPropertyBase
2. MessageContextPropertyBase or
3. PartContextPropertyBase
Answer is quite simple:
If the promoted property can be found in the source (incoming) message you need to use MessageDataPropertyBase.
If the property can be set in envelop, pipeline or manually promoted in the orchestration using Correlation Sets then MessageContextPropertyBase is used. This is also a useful technique if we want to maintain the original structure of the message and at the same time inject some properties that can be used in tracking or routing.
Lastly, suppose if I have a source message without a namespace and I need to map it to my internal schema with promoted properties how will I do it?
1. Create a custom receive pipeline with Set Namespace in Component in Decode Stage. Add an XML Disassembler with schema equals to the source schema with the expected namespace.
2. Add a Map, map source to internal schema (this should contain attribute/fields that will be promoted).
3. Add a Property Schema, question is, which Property Schema based to use?
4. Update internal schema to map the fields to promoted properties.
Note: I used MessageContextPropertyBase in Step # 3 and it works.