End-to-End Example: Order Entry
A real, complete example shipped with the repo — OrderEntryForm.cs (WinForms, 328 lines) and its WPF twin OrderEntryWindow.cs (307 lines). Master-detail, a trigger, an LOV, a validation rule, CALL_FORM, and a timer.
The shape of the screen
Master block Ord (single-record, with a navigation bar) and detail block OrdLine (PresentationMode = "Grid"), related by Id → OrderId. OrderDetailForm.cs / OrderDetailWindow.cs are the called-form counterparts, opened via CALL_FORM below.
The four-registration pattern
This is real, directly-quoted code from the example — the same shape the Object Navigator IDE writes when you author a trigger, LOV, validation rule, or master-detail relation visually (see Authoring).
1. A trigger — validate quantity on the way out of the field
manager.Triggers.RegisterTrigger(new TriggerDefinition(
TriggerType.WhenValidateItem, TriggerScope.Item)
{
TriggerId = "ord.qty.WhenValidateItem",
BlockName = "Ord", ItemName = "Qty", Handler = OnValidateQty,
});
2. An LOV — pick a quantity from a list of values
manager.LOV.RegisterLOV("Ord", "Qty", new LOVDefinition
{
LOVName = "QtyLov", DataSourceName = "DemoDb",
EntityName = "orderlines", DisplayField = "Qty", ReturnField = "Id",
});
3. A validation rule — enforce a range
manager.Validation.RegisterRule(new ValidationRule
{
RuleName = "Qty_Range", BlockName = "Ord", ItemName = "Qty",
ValidationType = ValidationType.Range,
ErrorMessage = "Quantity must be between 0 and 100.",
IsEnabled = true, MinValue = 0, /* MaxValue = 100 */
});
4. A master-detail relation
manager.CreateMasterDetailRelation("Ord", "OrdLine", "Id", "OrderId");
CALL_FORM
Pressing F11 opens the Order Detail form modally, forwarding parameters through the manager:
await _formsHost.CallFormAsync("OrderDetail", parameters, FormCallMode.Modal);
This needs an IWinFormFormsFactory assigned on the host's FormFactory — see WinForms Runtime.
A one-shot timer
The example also demonstrates CREATE_TIMER / WHEN-TIMER-EXPIRED with a one-shot demo timer, surfaced through the host's TimerFired event.
Proof, not just prose
Both example projects ship a large family of *SelfTest.cs files — Trigger, LOV alignment, Dirty-state, Rollback, Savepoint, Security, Multi-form, Query-by-example, and more — runnable headlessly via the --selftest command-line switch on either example app. These are real, executable proof of the behavior documented on this page, not stubs.