The Business Rules Engine that ships with BizTalk Server 2006 now supports the usage of static objects without passing that particular object into the rule as a "fact." However, a registry change is needed to get it working. Why is this valuable? Now you can build business rules that only require stateful objects to be passed in as facts, and leave helper functions, lookups and the like as static objects.
I was recently working on setting a timestamp on my XML document from within a business rule. With BizTalk Server 2006's changes for static object support, I wanted to use the standard "DateTime.Now" function contained in the mscorlib assembly, without passing an instance of that object into the rule as a fact. My business rule looked like this:
However, each time I ran it, I got nothing back in my XML node. After a request on our internal distribution list for some guidance, I got some help from the grand poo-bah of business rules, Jurgen Willis. Apparently the following key is required in the registry: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\BusinessRules\3.0\StaticSupport (DWORD) There are three valid values for this key:
The key wasn't present on my machine, so I'm not sure if this is something we're going to include in the RTM bits. But now you know, and knowing is half the battle.