建立自定义Biztalk的FunctoId

本文介绍如何在BizTalk Server 2006中创建自定义Functoid,包括项目搭建、引用添加、资源文件配置及Functoid实现逻辑等步骤。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

 

1.  VS2005中新建Class Libiary项目,就叫MyCustomId

 

 

2.  添加安装目录Program Files/Microsoft BizTalk Server 2006/Developer Tools里的Microsoft.BizTalk.BaseFunctoids.dll的引用,引用名字空间:

using Microsoft.BizTalk.BaseFunctoids;

using System.Reflection;

using System.Globalization;

using System.Resources;

 

3.  把默认的Class1改为MyCustomIdClass并继承BaseFunctoid

    public class MyCustomIdClass : BaseFunctoid

    {

    }

 

4.  项目里添加新项中添加资源文件:CustomFuncRes.resx,添加名称

 

并添加一个16*16的图像,叫MyImg

5.  FunctoId执行代码

static ResourceManager resmgr = new ResourceManager("MyCustomId.CustomFuncRes", Assembly.GetExecutingAssembly());

 

        public MyCustomIdClass()

        {

            int functoidID;

            functoidID = System.Convert.ToInt32(resmgr.GetString("MyFunctoId_ID"));

            this.ID = functoidID;

 

            SetupResourceAssembly("MyCustomId.CustomFuncRes", Assembly.GetExecutingAssembly());

 

            //FunctoId的设置

            SetName("MyFunctoId_Name");

            SetTooltip("MyFunctoId_Tips");

            SetDescription("MyFunctoId_Desc");

            SetBitmap("MyImg");

 

            this.SetMinParams(2);

            this.SetMaxParams(2);

                  

            SetExternalFunctionName(GetType().Assembly.FullName, "MyCustomId.MyCustomIdClass", "GetPerime");

 

            this.Category = FunctoidCategory.Math;

 

            this.OutputConnectionType = ConnectionType.AllExceptRecord;

            AddInputConnectionType(ConnectionType.AllExceptRecord);

        }

6.  FunctoId的逻辑代码:

   public string GetPerime(string RectangleLength, string RectangleBreadth)

        {

            int ilength = 0;

            int ibreadth = 0;

            int iPerimeter = 0;

            ResourceManager resmgr = new ResourceManager("MyCustomId.CustomFuncRes", Assembly.GetExecutingAssembly());

 

            RectangleLength = RectangleLength.Trim();

            RectangleBreadth = RectangleBreadth.Trim();

 

 

            if (IsNumeric(RectangleLength) && IsNumeric(RectangleBreadth))

            {

                try

                {

                    ilength = Convert.ToInt32(RectangleLength,

                              System.Globalization.CultureInfo.InvariantCulture);

                    ibreadth = Convert.ToInt32(RectangleBreadth,

                               System.Globalization.CultureInfo.InvariantCulture);

                    iPerimeter = 2 * (ilength + ibreadth);

                }

                catch

                {

                    throw new Exception(string.Format(resmgr.GetString(

                                        "MyFunctoId_Exception"),

                                        RectangleLength + " " +

                                        RectangleBreadth));

                }

            }

            return iPerimeter.ToString();

        }

7.  给项目属性里设置签名,或执行C:/ sn   -k MyFuncID.snk 生成密钥,编译项目。

8.  添加生成的dll文件到GAC,并copyBizTalk安装目录Program Files/Microsoft BizTalk Server 2006/Developer Tools/Mapper Extensions

9.  这样自定义的FunctoId就可以测试了。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值