Note: in this category I show some of the source code from the external assemblies
as well.
For each functoid I’ve shown:
Functoids covered in this category:
Database Lookup | Get Common Value |
Error Return | Remove Application ID |
Format Message | Set Common ID |
Get Application ID | Value Extractor |
Get Application Value | Common Code |
Get Common ID |
Download the complete series as a single Microsoft
Word document (1.2MB) or Adobe
PDF document (620kb).
Database Functoids |
||
Note: using any of the Database Functoids will cause the
<ExtensionObject Namespace=”http://schemas.microsoft.com/BizTalk/2003/ScriptNS0“ AssemblyName=”Microsoft.BizTalk.BaseFunctoids,
<ExtensionObject Namespace=”http://schemas.microsoft.com/BizTalk/2003/ScriptNS1“ AssemblyName=”Microsoft.BizTalk.CrossReferencing, |
||
Generates: XSLT calling a DLL |
Has XSLT Equivalent: No |
|
Emitted Code: <xsl:variable name=”var:v1“ select=”ScriptNS0:DBLookup(0 , string(@name) , string(@id) , “” , “”)” /> public string DBLookup(int index, string value, string connectionString, string table, string column) { DBFunctoidHelper helper = null; bool flag = false; InitDBFunctoidHelperList(); if (!myDBFunctoidHelperList.Contains(index)) { helper = new DBFunctoidHelper(); myDBFunctoidHelperList.Add(index, helper); } else { helper = (DBFunctoidHelper) myDBFunctoidHelperList[index]; } try { if (((helper.ConnectionString == null) || ((helper.ConnectionString != null) && (string.Compare(helper.ConnectionString, connectionString, StringComparison.Ordinal) != 0))) || (helper.Connection.State != ConnectionState.Open)) { flag = true; helper.MapValues.Clear(); helper.Error = “”; if (helper.Connection.State == ConnectionState.Open) { helper.Connection.Close(); } helper.ConnectionString = connectionString; helper.Connection.ConnectionString = connectionString; helper.Connection.Open(); } if ((flag || (string.Compare(helper.Table, table, StringComparison.Ordinal) != 0)) || (((string.Compare(helper.Column, column, StringComparison.OrdinalIgnoreCase) != 0) || (string.Compare(helper.Value, value, StringComparison.Ordinal) != 0)) || ((helper.Error != null) && (helper.Error.Length > 0)))) { helper.Table = table; helper.Column = column; helper.Value = value; helper.MapValues.Clear(); helper.Error = “”; OleDbCommand command = new OleDbCommand(“SELECT * FROM “ + table + ” WHERE “ + column + “= ?”, helper.Connection); OleDbParameter parameter = new OleDbParameter(); parameter.Value = value; command.Parameters.Add(parameter); IDataReader reader = command.ExecuteReader(); if (reader.Read()) { for (int i = 0; i < reader.FieldCount; i++) { string str = reader.GetName(i).ToLower(CultureInfo.InvariantCulture); object obj2 = reader.GetValue(i); helper.MapValues[str] = obj2; } } reader.Close(); } } catch (OleDbException exception) { if (exception.Errors.Count > 0) { helper.Error = exception.Errors[0].Message; } } catch (Exception exception2) { helper.Error = exception2.Message; } finally { if (helper.Connection.State == ConnectionState.Open) { helper.Connection.Close(); } } return index.ToString(CultureInfo.InvariantCulture); } |
||
XSLT 1.0 Equivalent: (none) |
||
XSLT 2.0 Equivalent: (none) |
||
Generates: XSLT calling a DLL |
Has XSLT Equivalent: No |
|
Emitted Code: <xsl:variable name=”var:v2“ select=”ScriptNS0:DBErrorExtract(string($var:v1))” /> public string DBErrorExtract(int index) { string error = “”; InitDBFunctoidHelperList(); try { if (myDBFunctoidHelperList.Contains(index)) { DBFunctoidHelper helper = (DBFunctoidHelper) myDBFunctoidHelperList[index]; if (helper != null) { error = helper.Error; } } } catch (Exception) { } if (error == null) { error = “”; } return error; } |
||
XSLT 1.0 Equivalent: (none) |
||
XSLT 2.0 Equivalent: (none) |
||
Generates: XSLT calling a DLL |
Has XSLT Equivalent: No |
|
Emitted Code: <xsl:variable name=”var:v9“ select=”ScriptNS1:FormatMessage(“” , “”)” /> |
||
XSLT 1.0 Equivalent: (none) |
||
XSLT 2.0 Equivalent: (none) |
||
Generates: XSLT calling a DLL |
Has XSLT Equivalent: No |
|
Emitted Code: <xsl:variable name=”var:v5“ select=”ScriptNS1:GetAppID(“” , “” , “”)” /> |
||
XSLT 1.0 Equivalent: (none) |
||
XSLT 2.0 Equivalent: (none) |
||
Generates: XSLT calling a DLL |
Has XSLT Equivalent: No |
|
Emitted Code: <xsl:variable name=”var:v4“ select=”ScriptNS1:GetAppValue(“” , “” , “”)” /> |
||
XSLT 1.0 Equivalent: (none) |
||
XSLT 2.0 Equivalent: (none) |
||
Generates: XSLT calling a DLL |
Has XSLT Equivalent: No |
|
Emitted Code: <xsl:variable name=”var:v8“ select=”ScriptNS1:GetCommonID(“” , “” , “”)” /> |
||
XSLT 1.0 Equivalent: (none) |
||
XSLT 2.0 Equivalent: (none) |
||
Generates: XSLT calling a DLL |
Has XSLT Equivalent: No |
|
Emitted Code: <xsl:variable name=”var:v3“ select=”ScriptNS1:GetCommonValue(“” , “” , “”)” /> |
||
XSLT 1.0 Equivalent: (none) |
||
XSLT 2.0 Equivalent: (none) |
||
Generates: XSLT calling a DLL |
Has XSLT Equivalent: No |
|
Emitted Code: <xsl:variable name=”var:v6“ select=”ScriptNS1:RemoveAppID(“” , “” , “”)” /> |
||
XSLT 1.0 Equivalent: (none) |
||
XSLT 2.0 Equivalent: (none) |
||
Generates: XSLT calling a DLL |
Has XSLT Equivalent: No |
|
Emitted Code: <xsl:variable name=”var:v7“ select=”ScriptNS1:SetCommonID(“” , “” , “”)” /> |
||
XSLT 1.0 Equivalent: (none) |
||
XSLT 2.0 Equivalent: (none) |
||
Generates: XSLT calling a DLL |
Has XSLT Equivalent: No |
|
Emitted Code: xsl:variable name=”var:v2“ select=”ScriptNS0:DBValueExtract(string($var:v1) , string(Field/text()))” /> public string DBValueExtract(int index, string columnName) { string str = “”; InitDBFunctoidHelperList(); if (myDBFunctoidHelperList.Contains(index)) { DBFunctoidHelper helper = (DBFunctoidHelper) myDBFunctoidHelperList[index]; columnName = columnName.ToLower(CultureInfo.InvariantCulture); object obj2 = helper.MapValues[columnName]; if (obj2 != null) { str = obj2.ToString(); } } return str; } |
||
XSLT 1.0 Equivalent: (none) |
||
XSLT 2.0 Equivalent: (none) |
||
Common Code (this is common code used by all the database functoids) |
||
<xsl:variable name=”var:v3“ select=”ScriptNS0:DBLookupShutdown()” /> public string DBLookupShutdown() { return string.Empty; } private class DBFunctoidHelper { private string column; private OleDbConnection conn = new OleDbConnection(); private string connectionString; private string error; private Hashtable mapValues = new Hashtable(); private string table; private string value; public string Column { get { return this.column; } set { this.column = value; } } public OleDbConnection Connection { get { return this.conn; } } public string ConnectionString { get { return this.connectionString; } set { this.connectionString = value; } } public string Error { get { return this.error; } set { this.error = value; } } public Hashtable MapValues { get { return this.mapValues; } } public string Table { get { return this.table; } set { this.table = value; } } public string Value { get { return this.value; } set { this.value = value; } } } |