BizTalk适配器生成分层架构

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了BizTalk适配器生成分层架构相关的知识,希望对你有一定的参考价值。

我正在尝试使用BizTalk适配器(SQL或WCF-SQL)来创建多级分层架构。我的查询是这样的

SELECT
    CustomerQueueMessage.customer_queue_ID  AS CustomerQueueMsgID,
    CustomerMaster.customer_ID              AS [CustomerID],
    CustomerAddressType.address_type_ID     AS [AddressTypeID],         
    CustomerSalesRep.sales_rep_type_code    AS [SalesRepTypeCode]
 FROM CustomerQueue AS CustomerQueueMessage 
 INNER JOIN dbo.MDM_Customer                AS CustomerMaster       ON (CustomerQueueMessage.customer_queue_ID = CustomerMaster.customer_queue_ID)
 INNER JOIN dbo.MDM_CustomerAddressType     AS CustomerAddressType  ON (CustomerAddressType.customer_queue_ID  = CustomerMaster.customer_queue_ID)
 INNER JOIN dbo.MDM_CustomerSalesRep        AS CustomerSalesRep     ON (CustomerSalesRep.customer_queue_ID     = CustomerMaster.customer_queue_ID)
 FOR XML AUTO, TYPE, ELEMENTS, XMLDATA

当我使用SQL适配器生成模式时,我得到了这个结构

enter image description here

我想要的是什么

enter image description here

表CustomerSalesRep在CustomerAddressType下。我希望CustomerSalesRep与CustomerAddressType处于同一级别,这两个级别都紧跟在CustomerMaster下。

如果我删除FOR XML语句并使用WCF-SQL适配器生成模式,我没有层次结构,所有列都处于同一级别。

有任何想法吗?我希望使用WCF-SQL适配器,但SQL也可以。

答案

你可以用它。

SELECT
    CustomerSalesRep.sales_rep_type_code    AS "CustomerQueueMessage/CustomerMaster/CustomerSalesRep/SalesRepTypeCode",
    CustomerAddressType.address_type_ID     AS "CustomerQueueMessage/CustomerMaster/CustomerAddressType/AddressTypeID",         
    CustomerMaster.customer_ID              AS "CustomerQueueMessage/CustomerMaster/CustomerID",
    CustomerQueueMessage.customer_queue_ID  AS "CustomerQueueMessage/CustomerQueueMsgID"
 FROM CustomerQueue AS CustomerQueueMessage 
 INNER JOIN dbo.MDM_Customer                AS CustomerMaster       ON (CustomerQueueMessage.customer_queue_ID = CustomerMaster.customer_queue_ID)
 INNER JOIN dbo.MDM_CustomerAddressType     AS CustomerAddressType  ON (CustomerAddressType.customer_queue_ID  = CustomerMaster.customer_queue_ID)
 INNER JOIN dbo.MDM_CustomerSalesRep        AS CustomerSalesRep     ON (CustomerSalesRep.customer_queue_ID     = CustomerMaster.customer_queue_ID)
 FOR XML PATH('SAPcustom'), TYPE, ELEMENTS

它生成这样的XML。

<SAPcustom>
  <CustomerQueueMessage>
    <CustomerMaster>
      <CustomerSalesRep>
        <SalesRepTypeCode>1</SalesRepTypeCode>
      </CustomerSalesRep>
      <CustomerAddressType>
        <AddressTypeID>1</AddressTypeID>
      </CustomerAddressType>
      <CustomerID>1</CustomerID>
    </CustomerMaster>
    <CustomerQueueMsgID>1</CustomerQueueMsgID>
  </CustomerQueueMessage>
</SAPcustom>

以上是关于BizTalk适配器生成分层架构的主要内容,如果未能解决你的问题,请参考以下文章

WF 4 还是 BizTalk 2010?

适配器减慢 BizTalk

BizTalk MQSC 适配器

BizTalk 2010 WCF-SQL 适配器 XML 轮询问题

BizTalk 2010 SMTP 适配器中的附件非英语名称

Biztalk 适配器包安装 - 没有看到 WCF-SQL 适配器