Closed teusch closed 9 years ago
There are two distinct things:
The models created by ModelsBuilder are read-only, front-end models, meant to make it easier to render content by adding strongly typed properties to the default front-end content objects.
The recommended, official, proper way to create and edit content (aka nodes, document, whatever, but really now it's "content") is therefore to use the content service and then, you are right, you have to resort to magic strings eg SetValue("prop", 1234)
.
It may make sense, in the future, to have these magic constants generated too, but it's outside the scope of the models builder project ;-)
Making sense?
Thanks, makes a lot of sense! Good to know what the scope is and that I didn't miss an obvious solution.
I will resort to a constants file or look into reflection to keep some sort of consistency.
Regards, Teus
Good.
Is it possible to create new Nodes with Models.Builder?
I assume that it is not possible because it depends on different Umbraco libraries? I always get confused between nodes , documents and ContentService.
Supposing it is not possible , would it be a nice idea to have the names of the properties available without having to resort to reflection? I can then use them in the SetValue method (SomeModel.Propertyx.Name)
Regards Teus