What is Rules Engine

Rules Engine is a . NET C# project that validates business logic by defining a bunch of rules for your data classes. Rules are defined using a fluent-interface (fluent validation) helper class, and not by decorating your existing objects with attributes, therefore de-coupling validation logic from data (or domain) classes.

Features

  • Rules are inheritable. Defining RuleX for TypeA will also apply to TypeB (given that TypeB inherits from Type A) Details.
  • Rules are extensible. Creating custom rules are only a matter of implementing an interface. Details
  • Conditional validation. When defining rules, it is possible to have different rules given different conditions. E.g. Not Null Rule only applies to FieldA when FieldB > 100. Details
  • Cross-Field validation. Defining a rule that FieldA must be greater than FieldB comes very naturally with the fluent-interface helper class. Details
  • Fluent-Interface. Adding rules to objects is done by a fluent-interface helper class. Details
  • Error Messages. Defining error messages can be done at the same time as defining your rules (Or separately). They can apply to the Class, A Property of that class, or a Rule for that property. Details

ASP.NET Mvc

An asp.net Mvc bridge is available for download. To use, create an instance of MvcValidationReport in one of your controllers, passing it your ModelState, Validate the model and that's it. The report will populate ModelState with error messages (if any). No more Attribute-Style validation.

NOTE: This does not support client-side validation.


Last edited Mar 16, 2012 at 5:16 AM by athoma13, version 13