共用方式為


用戶程式代碼中的訊息參考

建構訊息時,訊息的表示法位於 MessageBox 資料庫中,另一個表示法則位於電腦上的記憶體中。 如果您藉由將訊息的參考傳遞至 .NET 物件或外部元件來進行指派,然後 .NET 物件或外部元件在電腦的記憶體中修改了這個表示,BizTalk 協調流程引擎便無法察覺到這一修改。

此外,協調流程引擎不會使 MessageBox 資料庫中表示中的訊息元件數據失效。 訊息部分數據具有下列表示模式:

  • XmlDocument 表示法

  • 物件表示法

  • 數據流表示法

  • UnderlyingPart 表示方法

    訊息部分數據在記憶體中的表示方式取決於訊息建構,以及類型是 .NET 類別還是 XML 架構定義語言 (XSD) 架構。 不過,UnderlyingPart 表示法一律是指向 MessageBox 資料庫的數據流。 由於 BizTalk Server 中的訊息在訊息認可至 MessageBox 資料庫之後是不可變的,協調流程引擎會使用 MessageBox 資料庫中的表示法來參考訊息部分數據。

備註

如果您從已提交的訊息指派部分,則在 MessageBox 資料庫中建構的訊息可能已經有表示法。

例如,下列程式碼會將 MessageBox 資料庫中的 UnderlyingPart 資料傳送出去:

// In this example, assume m1 is committed to the MessageBox  
Construct m2 {   
               m2 = m1; // m2’s part data representation is the UnderlyingPart data of m1  
               m2(myContextProperty) = “123”; // m2’s part data representation is still the UnderlyingPart data of m1  
               A.test(m2.part); // orchestration engine does not invalidate the UnderlyingPart MessageBox representation  
             }  
Send(p.o, m2);  

您可以使用類似下列的程式代碼,將 XmlDocument 檔傳回至 Message XLANG 變數,而不是使用上述使用者程式代碼:

Void A.test(ref XmlDocument xd) {…}  
XmlDocument B.test(XmlDocument xd) {…}  
construct m2 {  
               m2 = m1;  
               m2(myContextProperty) = “123”; // m2’s part data representation is the UnderlyingPart data of m1  
               A.test(ref m2.part); // orchestration engine has enough information to know it has to invalidate the UnderlyingPart MessageBox representation  
               // or  
               m2.part = B.test(m2.part); // orchestration engine has enough information to know it has to invalidate the UnderlyingPart MessageBox representation  
             }