Some facts with distinguished field that often confused me:
-
· What is a distinguished field?
Yes, it is light-weighted, it stored as xpath pointer compared to promoted property stored in message context. Yes, distinguished field is mainly used in orchestration compared to promoted properties could be used everywhere. However, distinguished field CAN be used in pipeline component as well. The namespace for it is GlobalProperties. DistinguishedFieldsNamespace (
http://schemas.microsoft.com/BizTalk/2003/btsDistinguishedFields). As a reference, it could be set in pipeline component like followed code
m_msgCtx.Write(base.XPath, Globals.DistinguishedFieldsNamespace, str);
-
· How did its value been produced?
There is no magic of this, all BizTalk built in pipelines (except pass-through) implement a way to automatically promote the distinguished field while pipeline execution. Take XML disassemble for example, in its Disassemble method, it invokes XmlDasmReader to loop through all distinguished fields and promote them
IDictionaryEnumerator distinguishedPropertyAnnotationEnumerator = docSpecType.GetDistinguishedPropertyAnnotationEnumerator();
-
· What the above behavior means?
It means if you write your own disassemble pipeline component and does not deliberately promote the distinguished field by
propertyBag.Write(distField.XPath, Globals.DistinguishedFieldsNamespace,
distFieldNode.InnerText);
If you do not do this, you won’t be able to use the distinguished field in orchestration!
· Performance wise, which is better? Promoted property or distinguished field.
Distinguished field takes the lead. Since it is rather light-weighted and much less overhead.