Tribridge Connections

A Technology, Cloud Solutions & Industry Expertise Blog


Microsoft Business Rules Engine: Windows Workflow

Published: September 07, 2012

Microsoft Business Rules Engine

Business rules are what drive a line of business applications. How these rules are implemented is wide and varied. Ideally, you want to keep business rules in one place. Unfortunately, they continuously creep their way into the database and the UI layer far too often scattering logic all over the place and making the application hard to maintain and debug. How could we easily implement and maintain business rules in one place and have the ability to easily change them at a moment’s notice?

Several years ago Microsoft introduced Windows Workflow or WF. This business rules engine came with the handy ability to create rules and execute them at runtime. The developer could easily design complex business logic and insert them into a workflow. This is great if your application uses workflow, however what if it doesn’t?

Create Rules Outside a Workflow Project

Using Windows Workflow incurs some overhead and complexity that frankly, application architects don’t always want to deal with. So workflow has seen limited adoption unfortunately. It is possible to create a workflow project and rule sets to extract the rules file but this is a messy approach. Not too long ago Microsoft published a tool that enables developers to create rules files outside of a workflow project.

With this tool, a rules file can be created as a physical file or saved to a database. After this file is created, regular .NET code can be used to execute rules against a business object at runtime based on this rules file. The Microsoft business rules engine also supports a concept called forward chaining which basically means that if a subsequent rule changes a field that was referenced in a previous rule then the first rule is reevaluated. This is a powerful feature.

Benefits to this approach are many. Storing rules in one place, either in a file or database, makes maintenance very easy. The infrastructure also supports versioning or rules, so different rule sets can be updated for new processes while in flight processes can use the old rules.

The Microsoft business rules engine is very fast as well. Tests executing just a few rules against a simple business object ten thousand times yielded runtimes on the order of milliseconds. Maintaining business rules in one place is an important aspect of a well architected application. Microsoft Windows Workflow business rules engine is available as a standalone component ready to be used in any type of application.

Have any experiences with Microsoft Windows Workflow and creating rules outside a workflow project? I’d like to hear about them. Please feel free to comment below and share them with me.

Share Your Thoughts With Us

Load more comments
Thank you for the comment! Your comment must be approved first