Data Models are a way to represent business objects into an application
A Data Model is composed of Business Models
Properties are the attributes that have the same lifecycle as the object: when the object is deleted, the property is deleted
Relations are the attributes that have a different lifecycle as the object: when the object is deleted, the related object is not deleted Moreover, it is possible to link more than 1 object within a single relation
Use Strong Typing when defining a Data Model. E.g. : A model which has a temperature property should have a property of type “Temperature” (≠Number). Temperature can then be used independently of the unit (celsius, fahrenheit, …).
Define then functions to get the value as a number: E.g Temperature as °F, Temperature as °C, ...
The goal of this exercise is to create the data model of the "Notes" app.
- Go to Project “Notes”
- Open Folder “Data”
- Create a new Data Model named “Notes Data Model”
- Open the new Data Model
- Create a Business Model named “Note”
- Add String property “Summary”
- Add String property “Content”
- Create a Business Model named “Category”
- Add String property “Name”
- Create a relation from Model “Note” to Model “Category” and name it ”Category”