Data Modeling
Rules, Locks & Formulas
Declarative validation rules, conditional field locks, and calculated properties evaluated cleanly in C#.
Updated September 2026
•
5 min read
•
.NET 10 & C#
Three Types of Business Rules
1. Validation Rules
Must evaluate to true for the record to save. If false, execution blocks and the custom errorMessage is shown.
2. Assignment Rules (Calculations)
Computes a value from sibling properties (e.g. Quantity * UnitPrice * (1 - DiscountPercent / 100)) and assigns it to targetProperty on save, create, or update.
3. Record & Field Locks
While the condition expression holds, the entire record (or a specific target field) is rendered read-only.
Expression Language Guide
Expressions support arithmetic (+ - * /), comparisons (== != > < >= <=), boolean logic (&& ||), Today, Now, date math (DueDate + 14), and role tests (CurrentUser.HasRole("Manager")).