Share via


Biztalk Messages as .NET Classes distinguished property

If we are using a .Net  class  generated by xsd.exe from a schema.

we wont be able to acces the classed public fields inside the message assignment shapes / expressions etc.

To achieve that we need to edit the xsd generated cs file with the following attributes

[DistinguishedFieldAttribute()]  or       [PropertyNamespace.ShortPropertyName] // For properties

eg:

using System;
using Microsoft.XLANGs.BaseTypes; // this is required to be imported from c:\progfile\biztalk2006
Using PropertyNamespace;

namespace NetClass
{
   [Serializable]
   public class MsgClass
   {
      public MsgClass() // do necessary initialization here if required
      {
         StrField = "OK";
         IntField = 1;
         ShortField = 1;
      }

      [PropertyNamespace.ShortPropertyName] // For properties
      public Int16 ShortField;

      [PropertyAttribute(typeof(PropertyNamespace.StringPropertyName)]
      [DistinguishedFieldAttribute()]
      public String StrField;

      [DistinguishedFieldAttribute()] // For distinguished fields
      public int IntField;
   }
}

Comments