O'Reilly logo

Professional BizTalk® Server 2006 by Ewan Fairweather, Kevin B. Smith, Darren Jefford

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

7.10. Custom Rules Editor

Many customers that I've worked with have ended up with a requirement to develop a custom UI with which their businesspeople can construct rules. We do, of course, have the Business Rule Composer for this purpose, but in some cases customers require a more restricted or cutdown design (to perhaps make it more suitable for a very nontechnical audience). Such a requirement should not be taken lightly, because rules editors not only enable you create new rules but should also perform validation (such as protecting rules designers from creating infinite loops).

The creation of rules via an API is fully supported and is provided within the Microsoft.RuleEngine namespace. Via this API, you can produce, for example, an ASP.NET Web application that significantly simplifies the rule design experience.

Rules creation is pretty straightforward and easy to understand using the API. Consider the following code. It implements a rule that uses a .NET class called Customer and then deploys the rule to the SQL-based rule store ready for execution. (We cover the custom deployment code in the next section.)

The PolicyTester class covered previously in this chapter could be used to directly execute the RuleSet when constructed instead of requiring formal deployment, which is used here:

The following rule:

IF Customer.Age < 21 AND Customer.Salary < "20,000"
THEN Customer.LoanRisk = "High"

is constructed in this code:

// Bind to the Customer class we will use in the Rule ClassBinding ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required