How to implement a custom attribute to customize the Application Model

This example demonstrates how to create a custom attribute and remove a property from the Application Model's DetailView.Items and ListView.Columns node. In this case, the properties marked with this attribute will be removed from views.

Implementation Details

To implement this functionality, the IModelMember interface is extended with the IRemovedFromViewInfo interface that contains a single property - IsRemovedFromViewInfo. The value of this property is calculated based on the value of the custom attribute we created (RemoveFromViewInfoAttribute) and applied to the persistent class. This is done via the domain logic (RemovedFromViewInfoLogic). Then the IRemovedFromViewInfo.IsRemovedFromViewInfo property is used by the model nodes generator updater (ViewsNodesGeneratorUpdater) to remove certain view items and columns from detail and list views. Thus, the example demonstrates three techniques: extending the Application Model with additional properties, defining default model values via the domain logic and changing the default model via the model nodes generator updater.

Files to Review

Documentation

Create Additional ListView Nodes in Code Using a Generator Updater Add Custom Nodes and Properties to the Application Model in Code