DataBase Functoids里除了DB Lookup,Error Return和Value Extractor之外还有几个如
Get CommonID,Get CommonValue,Get ApplicationID,Get ApplicationValue,Set CommonID,FormatMessage等等几个
1.Cross Reference表的建立
The cross referencing database functoids use data from tables stored in the BizTalkMgmtDb SQL Server database. The Configuration Wizard creates the necessary tables in the database during installation. The tables are, however, initially empty.
The BizTalk Server Cross Reference Import tool (btsxrefimport.exe) reads data from a group of nine XML documents and stores the data in the appropriate tables.
默认cross reference functoid所需要的表是存储在BizTalkMgmtDb数据库中的,包括如下几个表:
我整理了这几个表的外键关联关系,如上图.
这几个表初始状态下没有内容,需要通过biztalk提供的一个工具btsxrefimport.exe读取特定的9个xml文件导入数据
btsxrefimport -file=setupfile.xml
setupfile.xml如下,指定了其他8个xml的读取路径
<?xml version="1.0" encoding="UTF-8"?> <Setup-Files> <App_Type_file>c:\ListOfAppType.xml</App_Type_file> <App_Instance_file>c:\ListOfAppInstance.xml</App_Instance_file> <IDXRef_file>c:\ListOfIDXRef.xml</IDXRef_file> <IDXRef_Data_file>c:\ListOfIDXRefData.xml</IDXRef_Data_file> <ValueXRef_file>c:\ListOfValueXRef.xml</ValueXRef_file> <ValueXRef_Data_file>c:\ListOfValueXRef_Data.xml</ValueXRef_Data_file> <Msg_Def_file>c:\ListOfMessageDefinition.xml</Msg_Def_file> <Msg_Text_file>c:\ListOfMessageText.xml</Msg_Text_file> </Setup-Files>
而这几个Functoid,基本就是针对以上几个表的操作
1.Get CommonID:
参数:object type,application instance,application identitier
所以根据关系图,注意到操作xref_IDXRefData,xref_IDXRef,Xref_AppInstance三个表
2.Get CommonValue
参数:object type,application type,application value
操作表:xref_ValueXRefData,xref_ValueXRef,xref_AppType
3.Get ApplicationID
参数:object type,application instance,common id
操作表:同Get Common ID
4.Get ApplicationValue
参数:object type,application type,common value
操作表:同Get Common Value
5.Set CommonID
6.Remove Application ID
7.FormatMessage
关于这几个 Functoid ,我一般用来用来存取一些配置信息,比如说数据库连接字符串,一些敏感信息等等之类的
比如说,我可以把connection string 存储在xref_IDRefData.commonID中,使用Get CommonID读取出来
1.ListOfIDXRef.xml
<?xml version="1.0" encoding="UTF-8"?>
<listOfIDXRef>
<idXRef>
<name>ConnectionString</name>
</idXRef>
</listOfIDXRef>
2.ListOfIDXRefData
<?xml version="1.0" encoding="UTF-8"?>
<listOfIDXRefData>
<idXRef name="ConnectionString">
<appInstance name="ApplicationOne_01">
<appID commonID="Server=.;Database=DataCenter;User Id=sa;Password=;">DataCenterDB</appID>
<appID commonID="Server=.;Database=EDI;User Id=sa;Password=;">">EDIDB</appID>
</appInstance>
</idXRef>
</listOfIDXRefData>
另高兴的是,Cross Reference不光可以在Map中使用,而且也可以在Orchestration 中通过Expression 调用,当然了要求引用Microsoft.BizTalk.CrossReferencing.dll
如上面的在Orchestration中可以通过以下表达式读取ConnectionString
string connStr;
connStr=Microsoft.BizTalk.CrossReferencing.GetCommonID("ConnectionString","ApplicationOne_01","DataCenterDB");
To Be Continued...