Optimize the BizTalk productivity using ListDictionary

In this period, I’m supporting different development teams to implement a big integration solution using different technologies such as BizTalk Server, Web API, Azure, Java and other and involving many other actors and countries.
In a situation like that is quite normal to find many different problems in many different areas like integration, security, messaging, performances, SLA and more.

You can download the entire article as a PDF document.
Optimize the BizTalk productivity using ListDictionary

One of the most important aspects that I like to consider is the productivity, writing code we spend time and time = money.
Many times a developer needs to find a solution or he needs to decide a specific pattern to solve a problem and we need to be ready to provide the most productive solution for it.

For instance, a .Net developer can decide to use a plain function to solve a specific loop instead using a quicker lambda approach, a BizTalk developer can decide to use a pure BizTalk approach instead using a quicker and faster approach using code.

To better understand this concept, I want to provide you a classic and famous sample in the BizTalk planet.

An usual requirement in any solution is, for example, the possibility to pick up data in composite pattern and cycling for each instance inside the composite batch, in BizTalk server this is the classic situation where we are able to understand how much the developer is BizTalk oriented J

By nature, the BizTalk development approach is more closed to a RAD approach rather than a pure code approach.

To cycle in a composite message in BizTalk we can use different ways and looking in internet we can find many solution, one of the most used by BizTalk developer is creating an orchestration, create the composite schema, execute the mediation, receive the composite schema in the orchestration, in the orchestration cycle trough the messages using a custom pipeline called in the orchestration.

Quite expensive approach in term of productivity and performances.

Another way is using for example a System.Collections.Specialized.ListDictionary in the orchestration.

Create a variable in the orchestration type System.Collections.Specialized.ListDictionary

Create a static class and a method named for example GetAllMessages

Inside your method write the code to pick up you messages and stream and load into the ListDictionary

Create an expression shape and execute the method to retrieve the ListDictionary

xdListTransfers = new System.Collections.Specialized.ListDictionary();

MYNAMESPACE.Common.Services.SpgDAL.GetAllMessages(ref xdListTransfers,

ref numberOfMessages,

ref dataValid);

Use variable by ref to manage the result, the variable numberOfMessages
is used to cicle in the orchestration loop.

Because we use a ListDictionary we can easily get our item using a key in the list, as below using the numberOfMessagesDone variable.

xmlDoc = new System.Xml.XmlDocument();

transferMessage = new MYNAMESPACE.Common.Services.TransferMessage();

transferMessage = (MYNAMESPACE.Common.Services.TransferMessage)xdListTransfers[numberOfMessagesDone.ToString()];

Where numberOfMessagesDone
is the increment value in the loop

Using this method, we keep our orchestration very light and it’s very easy and quick to develop.

I have many other samples like that, this an argument which I’m really care about because able to improve our productivity and performance and first of all the costs.

You can download the entire article as a PDF document.
Optimize the BizTalk productivity using ListDictionary
  • Hi Nino,

    Can you please share the source code of static class file which we are calling from Orch? That way I think it would be bit easier to understand the complete logic. Also I would like to do a demo myself on how much performance efficient it is compred to regular approach.


    • Hi Vikash,
      happy to support you in order to understand the differences between the approaches

      in term of development productivity, in my opinion, is obvious, the code approach is a lot faster.

      In term of coding I’m curious to see some timespan reports

      the static class is very simple, use something like that:

      public static bool GetAllMY_SINGLE_FOOS(ref ListDictionary xdListTransfers,
      ref int numberOfMessages,
      ref bool dataValid)


      while (sqlReader.Read())
      //FILL THE ListDictionary

      xdListTransfers.Add(i.ToString(), MY_SINGLE_FOO);
      numberOfMessages = i;



      return true;
      catch (Exception ex)




      just call the static method GetAllMY_SINGLE_FOOS in the orchestration and using a simple loop
      About the other approach just use a composite approach to pickup the data from the same SQL table and cicle in the orchestration using a pipeline debatching

      Let me know 🙂