How to invoke static methods from the rules engine

A colleague pointed out a rather surprising tidbit about the BRE to me recently – that by default it is not possible to invoke static methods on .Net classes.

This caught me out and was not obvious to spot. I had various string constants defined in a .Net assembly and was comparing them to fields in a message instance, but finding that the comparison was failing. When I tested these rules using the Business Rules Composer it seemed these conditions were not even being tested!

The simple solution is a registry change, modifying the key:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\BusinessRules\3.0\StaticSupport

and giving it a value of 1.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


%d bloggers like this: