Model Code
Let’s learn how the model of the application is coded.
We'll cover the following...
Code each class of the JS class model
For instance, the Publisher class from the JS class model is coded in the following way:
We add the derived multivalued reference property publishedBooks, but we don’t assign it in the constructor function. This is because it’s a read-only property that’s assigned implicitly when its inverse leader reference property Book::publisher is assigned.
Code the set methods of single-valued properties
Any setter for a reference property that’s coupled to a derived inverse reference property also needs to assign, add, or remove inverse references to and from the corresponding collection value of the inverse reference property. An example of such a setter is publisher in the Book class:
For any multivalued reference property that’s coupled to a ...