RickGaribay.NET

.NET, WCF, SOA, Phoenix Connected Systems User Group, and miscellaneous discussions on software engineering, process and practices.
posts - 142, comments - 91, trackbacks - 4

BizTalk Messages & Generic Collections

It appears that the BizTalk compiler has a problem with generic types.

When using the generic List<T> for a collection of .NET types, the class library (or course) compiles fine. The code looks something like this:

using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.XLANGs.BaseTypes;
 
 
 
namespace Northwind.BusinessEntities.RetailOps
{
    [Serializable]
    public class PurchaseOrder
    {
        private int m_PurchaseOrderId;
        private string m_FirstName;
        private string m_LastName;
        private string m_ShippingAddressLine1;
        private string m_ShippingAddressLine2;
        private string m_ShippingState;
        private int m_ShippingZipCode;
        private int m_AccountNumber;
        private string m_Expiry;
        private InventoryItem[] m_Items;
 
       
       
        public InventoryItem[] Items
        {
            get
            {
                return m_Items;
            }
            set
            {
                m_Items = value;
            }
        }

When compiling a BTS 2006 project, however, the compiler barks with a very helpful (not!) exception: Unknown Exception.

Interestingly, changing the m_Items type from a generic List<T> to a plain ol array appeases the BizTalk gods:

 
        private InventoryItem[] m_Items;
       
        public InventoryItem[] Items
        {
            get
            {
                return m_Items;
            }
            set
            {
                m_Items = value;
            }
        }

Surprisingly, both collections produce identical XSD:

      <xs:element minOccurs="0" maxOccurs="1" name="Items" type="ArrayOfInventoryItem" />

It would definetely be nice if generic collections were supported in the next version of BTS. This is a key feature that is prevelant in C# classes and not including support for it will result in un-natural programming techniques that will only build technology debt.

Print | posted on Tuesday, October 24, 2006 3:52 PM |

Feedback

Gravatar

# re: BizTalk Messages &amp; Generic Collections

11/14/2006 9:17 PM | peter kiesewetter

Post Comment

Title  
Name  
Email
Url
Comment   
Please add 1 and 8 and type the answer here:

Powered by: