With our next major release (13.2), we have simplified the manner in which you are able to add custom and computed fields to existing business models. The functionality is available to both developers and end-users.
Once beta 1 is released, you can explore this new custom member functionality by exploring the FeatureCenter solution located in the C:\Users\Public\Documents\DXperience 13.2 Demos\eXpressApp Framework\FeatureCenter\CS folder.
As you know, XAF already offered the ability to create non-calculated persistent fields at design time using the Model Editor. In 13.2, we’ve extended the Application Model with an Expression attribute as illustrated in the image below.
When the Expression attribute has a value, XAF will create a calculated member or it will default to the creation of a persistent member. Additionally, you can create a complex expression such as the Sum of another custom field as illustrated below.
By design, XAF will not display these custom fields in any view since they were created manually after the Application Model was generated.
The great thing is that in 13.2, end-users can use the runtime version of the Model Editor to create custom members and extend the business domain as discussed in the previous section.
The image below illustrates where to locate the custom member in the Windows version of our FeatureCenter (same location for the web).
To invoke the runtime Model Editor, end-users can execute the Edit Model action.
You may also want to restrict Application Model modification to certain user groups. You can do that as illustrated below.
Developers can restrict end-users from creating custom members at runtime by setting the static ModelMemberRequiredCalculator.AllowPersistentCustomProperties to false.
The Web Runtime
To create a custom member for the web, you can use the Standalone Model Editor and edit the Model.xafml file located in the root of the web-site.
Custom members are in their first release (CTP) so we look forward to your feedback as we get it ready for the official release. Let me know what you think.