Skip to content
Scott Reeves edited this page Feb 23, 2021 · 5 revisions

In xHV, a model is simply an object that knows about database entities and contains enough logic to implement business rules about those entities.

For example, in the demo, there is only one model: DemoClientModel.cls.

It contains public properties that map to the fields in the DemoClient table, namely:

  • Id
  • Name
  • Email

Notice something important here: while we can easily add validation logic to those properties, the model knows nothing of how to retrieve or persist that data. That's the job of the DemoClientService.

In xHV, Models have the o conventions:

  • They are CLASSES, not modules
  • They are named {Entity}Model.cls
  • They contain only the business logic to validate themselves
  • They depend on Services for persistence
  • They maintain the working state of objects in memory

Clone this wiki locally