BizTalk - How to create custom functoid.

Functoid is no more than a piece of .Net code, find my another post BizTalk-Get to know functoid for more detail. The functoids coming with BizTalk do not always satisfy your needs. How to create our own custom functoid? In this article, I want to create a functoid which get current date/date time based on given format.

1. All functoids are derived from BaseFunctoid class which is built in Microsoft.BizTalk.BaseFunctoids.dll, it can be found under <BizTalk Installation Path>\Developer Tools.

2. BizTalk artifacts are required to be deployed in GAC, that’s to say they are strong named assemblies, we need a snk file. You can create a snk file by running sn –k sn.snk visual studio command prompt window.

3. Coding time now! Let’s create a c# class project called FunctoidDemo, include sn.snk in this project and add reference to Microsoft.BizTalk.BaseFunctoids.dll.

4. In this step we add a resource file to FunctoidDemo solution. BaseFunctoid is designed to store some settings in resource file such as functoid name, tooltip, tool description, so all derived functoid class should also have its related resource file.

 

5. The real c# code is pretty simple.

Code


6. Register FunctoidDemo.dll go GAC by running GacUtil -I FunctoidDemo.dll.

7. Copy FunctoidDemo.dll to <BizTalk Installation Path>\Developer Tools\Mapper Extensions, If you skip this step, you will get an error like this.

 

8. Add this custom functoid to tool box. NOTE: FormattedDate is the class name, it is different from assembly name.

 

9. Now add a BizTalk project to current solution for testing purpose.

 

I keep the map very simple for easy testing. The selected functoid is my custom functoid, the icon looks a little bit ugly. J I did not dray anything, just a white square, a beautiful icon does not help anything from technical perspective.

 

10. Specify the input parameter as yyyyMMdd, I want to use this pattern to format current date time.

 

11. Now I test the map with automatically generated sample file, see the output data.

 

The checkInTime is formatted as 20080529.

12. Source code download.

I will explain the structure of BaseFunctoid class in detail later.
Hope it helps!

posted on 2008-05-29 23:39 zhanqiangz(闲云野鹤) 阅读(1279) 评论(1)  编辑 收藏 所属分类: CSharpBizTalk

评论

#1楼  2008-05-30 08:51 nightbeer [未注册用户]

纯英文啊,真有些吃力
依然感谢!   回复  引用    


标题  
姓名  
主页
Email (博主才能看到) 
验证码 *  看不清,换一张 [登录][注册]
内容(请不要发表任何与政治相关的内容)  
  登录  使用高级评论  新用户注册  返回页首  恢复上次提交      
该文被作者在 2008-05-29 23:58 编辑过


相关链接:
 


<2008年5月>
27282930123
45678910
11121314151617
18192021222324
25262728293031
1234567

导航

统计

公告

如转载本博客的相关资料敬请注明出处.谢谢合作!

与我联系

搜索

 

常用链接

留言簿(6)

我参与的团队

我的标签

随笔分类(51)

随笔档案(49)

文章分类(7)

文章档案(5)

收藏夹(3)

.NET

BizTalk

Design

JavaScript

My Blogs

Power Tools

Process Control

Search Engine

SQL Server

XML

积分与排名

最新评论

阅读排行榜

评论排行榜