You use Check model in MDriven Designer to find and correct rule violations in your model, especially after editing expressions, changing names, merging model files, or encountering errors in saved model XML.
MDriven Designer performs static type checking and expects the model to comply with its rules. Errors can appear while you edit, and the Model Check and Report Errors Tool helps you review and follow errors after you save.
Check and correct model errors
- Save the model.
- Open the Model Check and Report Errors Tool. A red error indicator means that the model contains one or more errors.
- Select an error in the report and follow its lead to the affected model element.
- Read the error together with the expression, ViewModel setting, action, association end, or other model element it identifies.
- Correct the model element, then save again.
- Confirm that the error indicator and the entry in the error report disappear.
Correct errors as soon as they appear. A name change can invalidate expressions elsewhere in the model, so one change may produce several reported errors.
Understand common errors
An expression refers to a name that no longer exists
A common error occurs when you rename a role, attribute, class, or other model element but do not update expressions that use its old name.
For example, if an action on Car refers to self.CloseSale and you change the expression to self.CloseSales, the editor reports that CloseSales is not a member of Car. Select the reported error, open the action or expression, and restore the valid member name or update it to the renamed model element.
The same applies when you change a link-role name. If an association role changes from HistoricOwnership to HistoricOwnerships, update every expression that refers to the old role name. Training:Bootcamp:Chapter 10 walks through these examples.
A ViewModel has an incompatible root configuration
A ViewModel must state the class it uses as its root class. Its Requires Root setting must also agree with the actions that open it.
For example, a ViewModel rooted in Person can be opened by an action that supplies a Person object. If you clear Requires Root while generated actions still supply a Person, MDriven Designer reports errors on those actions. Select the error leads, review the action and ViewModel configuration, and make them agree.
Some ViewModel-related errors may initially appear only in the ViewModel editor rather than in the Model Check and Report Errors Tool. If that happens, save the model and restart MDriven Designer, then run the check again. Training:Bootcamp:Chapter 3 provides a worked ViewModel example.
An action points to a missing ViewModel
An action that opens or uses a ViewModel requires that ViewModel to exist and have the expected configuration. If you create an action before creating its target ViewModel, MDriven Designer reports an error. Create the required ViewModel, set its root class, and select Requires Root when the action supplies an object as the root.
An action has no name
An unnamed action can be an orphaned model object. This may happen when a class is deleted but its class action remains. Follow the dedicated procedure in Documentation:Action must have a name; it includes an EAL expression for locating and deleting unnamed actions in the model debugger.
Investigate errors that do not lead to an editable element
Most model errors lead directly to the relevant editor. Use the model debugger when the reported object is difficult to locate, appears to be stuck, or the saved model contains XML errors after a repository merge.
Open the model debugger
- In MDriven Designer, right-click an empty area of a diagram background.
- Select Extras â Open Model Debugger....
- In the debugger, select the model object that you need to inspect.
- Open the object editor to examine its properties and links.
Use the object editor to determine why the object is invalid or where it is referenced. This is particularly useful when the normal error lead cannot open an editor for the offending object.
Remove an offending model object with EAL
The model debugger can execute EAL against the model itself. Use deletion only after you have identified the exact invalid object and understand the effect of removing it.
For example, the procedure for orphaned unnamed actions uses an EAL expression to select actions whose names are empty and delete them. See Documentation:Action must have a name for the exact expression and execution steps.
Do not use broad delete expressions as a first response to a model-check error. First inspect the object, correct references where possible, and then save and run Check model again. Deleting a model object can leave other expressions or configurations invalid if they refer to it.
When the error is not a model error
Check model validates the MDriven Designer model. It does not validate application rows or database column definitions.
| If you are checking | Use | Example |
|---|---|---|
| Model rules, expressions, ViewModel configuration, and model objects | Model Check and Report Errors Tool in MDriven Designer | An action refers to self.CloseSales, but Car has no such member.
|
| Consistency of application data or database columns | Documentation:Validate data in the database in MDrivenServer | A database string column is shorter than the corresponding model attribute, or a link has duplicate values. |
| A Turnkey application that cannot start | HowTos:Resolve 'Not able to start' Error | The application has no CurrentVersion, is paused, or has no uploaded model. |
For database consistency findings, do not delete rows directly without considering their references. The database-validation guidance describes using the debugger to remove disconnected objects so their linked aggregate objects and links are handled correctly.
Troubleshooting sequence
When you encounter a red error indicator or a model error after a merge:
- Save the model.
- Open the Model Check and Report Errors Tool and work through each error lead.
- Correct renamed members, invalid expressions, missing ViewModels, and incompatible root settings.
- Save and verify that the error report is empty.
- If an error points to an object you cannot find or XML errors prevent normal correction, open the model debugger from the diagram background.
- Inspect the object in the object editor. Use EAL deletion only for an identified offending object.
- Save the model and run the check again.
