First argument of "Value()" method requires an IPublishedValueFallback. How could I get my property value, what kind of argument should I pass to the method ?
But it's not what I try to achieve.
Let me reformulate my question: how could I get the property value of a documentType outside a view?
To explain what I want. I want to deal documentType's data with my own models because somewhere in my code I don't want Umbraco to be referenced. This means I have to "map" IPublishedContent to my models using Model.Value(...).
Is this possible without providing an IPublishedValueFallback ?
Umbraco 11 - Model.Value - No ModelsBuilder
Hi everyone
I'm under Umbraco 11.
I want to access documentType's property value without using the models builder.
According to documentation https://docs.umbraco.com/umbraco-cms/fundamentals/design/rendering-content/, it's Model.Value("alias") but it's not.
First argument of "Value()" method requires an IPublishedValueFallback. How could I get my property value, what kind of argument should I pass to the method ?
Does your view have
@inherits UmbracoViewPage
Model.Value("alias") does not require a fallback
From a view this is working indeed.
But it's not what I try to achieve. Let me reformulate my question: how could I get the property value of a documentType outside a view?
To explain what I want. I want to deal documentType's data with my own models because somewhere in my code I don't want Umbraco to be referenced. This means I have to "map" IPublishedContent to my models using Model.Value(...).
Is this possible without providing an IPublishedValueFallback ?
You should probably use the IPublishedContentQuery to get your content
https://docs.umbraco.com/umbraco-cms/implementation/services
Thanks for your responses.
Of course I'm already using IPublishedContentQuery. And still it gives me an IPublishedContent I want to map with a model of my own.
But nevermind... I already found a solution... using ModelsBuilder even if I didn't want to... (opportunity knocks) :-)
Umbraco does not know anything about your models, only IPublishedContent (unless you use modelsbulder to give you strongly typed content)
You could try this approach
https://our.umbraco.com/forum/using-umbraco-and-getting-started/107323-using-iumbracomapper-to-map-custom-models-or-automapper
is working on a reply...