Share via


BizTalk Server 2010: .NET Helper Classes

Introduction

.NET classes can be used inside an orchestration. They can be divided into two distinct categories according to Optimizing Orchestration Performance recommendations:

  • Helpers and services - These classes provide common services to orchestrations such as tracing, error handling, caching, and serialization/deserialization. Most of these classes can be implemented as static classes with no internal state and multiple public static methods. This approach avoids creating multiple objects of the same class in different orchestrations running at the same time, which helps to reduce the working space of host processes and save memory. A class that is stateless helps to reduce the overall size of the internal state that must be serialized and persisted to the BizTalk MessageBox when an orchestration is dehydrated.
  • Entities and Business Objects - You can use these classes to manage entities, such as orders, order items, and customers. A single orchestration can internally create and manage multiple instances of the same type. These classes are typically stateful, and expose public fields and/or properties along with methods to modify the internal state of the object. Instances of these classes can be dynamically created by deserializing an XLANGMessage part into a .NET object by using the XmlSerializer or the DataContractSerializer classes or by using the XLANGPart.RetrieveAs method. You should structure an orchestration using non-transactional scopes in such a way that instances of stateful classes are created as late as possible and released as soon as they are no longer needed. This approach reduces the working space of host processes and minimizes the overall size of the internal state that is serialized and persisted to the MessageBox database when an orchestration is dehydrated.

This article will focus on the first category .NET Helper classes.

Helper Class .NET

A class can be created inside Visual Studio using the class library template. You open Visual Studio and create a new class library project. This project can contain one or more classes. Each class will have be marked as Serializable, see sample code below:

[Serializable]
public static  class YourClass
{
     public static  type myMethod(type myparameter, ....)
     {
           ...your code
     }
  
     ... if  necessary you can implement more static methods!
}

.NET Classes can be useful to create an instance of message, look up reference or other data, perform queries in the message, and obtain custom configuration settings.

Samples

See Also

Read suggested related topics:

Another important place to find an extensive amount of BizTalk related articles is the TechNet Wiki itself. The best entry point is BizTalk Server Resources on the TechNet Wiki.