]> Static Methods in BRE 🌐:aligrant.com

Static Methods in BRE

Alastair Grant | Thursday 28 January 2010

If you want to call a .NET function from within the BizTalk 2006 Business Rules Engine (BRE) then you need to first create an instance of your containing class and the instance into the engine.

This is even the case for static functions, which is a pain in the arse. All I want to do is concatenate two strings - so it makes sense to use System.String.Concat().

The reason for this is because the rules engine needs you to "assert" "facts" before they can be used.

Lucky for us, somebody thought this was silly and has added support for static methods without having to pass or assert a .NET class. It's easily enabled according to the MSDN documentation.

Or so I thought. The registry key mentioned in the above article does not exist on my computer, nor any of our servers. Finally after much head scratching I realised my repeated school boy error and found the node under Wow64. So if you're running on a 32-bit OS then the registry key is as described by Microsoft, otherwise it's here:

[HKEY_LOCAL_MACHINE/SOFTWARE/Wow6432Node/Microsoft/BusinessRules/3.0]

The net benefit, you can now add "mscorlib" to your rules composer to access base classes such as String. Which opens up the ability to run String.Concat().

Breaking from the voyeuristic norms of the Internet, any comments can be made in private by contacting me.