BizTalk-Get to know functoid.

Summary: This article is intended to give you a general idea about what’s functoid in BizTalk. Functoid is no more than a piece of .Net code whichn can perform a complete function.

1. Get Reflector ready before we get started. It can help us to disassemble DLLs and executables, get it from http://www.aisto.com/roeder/dotnet
2. Prepare functoids assembly, once you have BizTalk installed, Microsoft.BizTalk.BaseFunctoids.dll can be found on your machine.
3. Open Microsoft.BizTalk.BaseFunctoids.dll in Reflector and expand this DLL you can find many classes/enumerations such as AssertFunctoid, BaseFunctoid, etc. Take a look at the following screenshot for reference.

4. Every functoid is a class. Just right click on one class you want and select Disassemble. Sorry, I choose BaseFunctoidIDs here, it is an enumeration type. Basically it contains all the functoids coming with BizTalk 2006 R2. (I use BizTalk 2006 R2, I cannot guarantee you can get the same result if you are working with other versions).
BaseFunctoidIDs

5. Now I am choosing BaseFunctoid. It is a little big; every specific functoid will inherit from this abstract class.

BaseFunctoid

6. Not every property/ function we should pay attention to, we will talk about that in another session.
7. Now let’s take a look at StringLeft functoid. Pay special attention to GetCSharpBuffer method, it uses StringBuilder to create a c# function like this:

StringLeft

This function is gonna be used in physical map.
8. Create a map to use this functoid.

Right click on the map file (SourcetoTarget.btm) and select Validate map。Please remember, you can get the actual xsl file which will do the transform. From the output window the automatically generated xsl file can be found, open it. In this xsl file you can clearly find the StringLeft function mentioned above and its referenced function(s), IsNumeric in this case.


The idea is when a functoid is put onto the surface of map, it will generate a function in xsl file, xsl can call this code at run time to do transfrom.
posted @ 2008-05-08 22:39  zhanqiangz(闲云野鹤)  阅读(1493)  评论(4编辑  收藏  举报