Posted on 18/02/2019 08:40:38
Hi Nuno,
Sorry about the delay - I missed your question in all the others, but luckily somebody told med to recheck. (Y)
I think your question is an important and very interesting one, because of the way viewmodels work. So I'll have to explain some details in depth a bit more thourghly than what is probably needed to explain the whole toolset. In general we have 2 different ways of rendering data from a viewmodel:
1. Viewmodels in webservices
2. Viewmodels in templates (razor)
For #1, we need to specify which properties to fill, to make sure that we only get exactly the needed data. This is because, we use a json-serializer, which accesses all properties and writes json to match the viewmldels and their proerties. Here all properties are accessed.
For #2, we have a different setup. When use a viewmodel in a razor-template, we have an object with a number of properties, and only the needed properties are accessed. Since all the expensive ones are lazy-loaded, this means, that you only pay for the properties you use. So in general, you can leave all properties "active" in the viewmodel catalog without having to pay the price for them! They only "cost" something, if you access them in the template.
The reason why you get to choose to toggle the properties from backend is, that our own templatesets will probably be written in such a way, that they change the way the page is rendered, based upon what information is available. This scenario is a bit more difficult than what I would suspect a typical customer requires, so it can probably be ignored unless a specifc need arises.
Hope this explaination helps.
BR
Martin