BizTalk适配器生成分层架构

问题描述 投票:2回答:1

我正在尝试使用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也可以。

sql wcf xsd biztalk biztalk-2016
1个回答
1
投票

你可以用它。

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>
© www.soinside.com 2019 - 2024. All rights reserved.