The attribute denotes the property represents that alias on the doctype. It’s there because you can extend these classes with your own properties and override the generated ones.
The reason the property starts with an uppercase D is down to naming conventions. All the API properties start with capitals like .Name or .Url — so the generated ones do too.
Property alias not found when previewing page
Hello,
I'm getting the following error when I try to preview my page:
The page is based on a document type with the following property:
I've search throughout my entire solution for files containing VIPCard and found two:
.../AppData/Models/all.generated.cs .../AppData/Models/models.generated.cs
I'm not sure if this is the right place to be looking, but in these files I find the follow code snippet (exactly the same in both):
Seems to be there (though I don't know what GetPropertyValue(...) is returning).
Are these not the right files to be looking in?
Anyone ever had this problem before?
Thanks.
Gibran Shah, add more details by posting the code of the master template of that document type.
Hi Gibran,
The property that Models Builder returns is case sensitive, and gets capitalised, so try referencing it like this:
Notice the capital 'D'
You could also obtain it via its alias through the api like:
Which is just what the Models Builder generated code is doing.
Hope this helps!
Chris
Hi Tarik,
Thanks for the response.
My templates look like this:
My master template looks like this:
The VIP Card template looks like this:
Gibran, try to use
@Model.Content.DailyIndividual
more info here. Also in the code you posted there is the following:Thanks both for your suggestion.
I changed dailyIndividual to DailyIndividual and it worked.
I assumed the attribute...
[ImplementPropertyType("dailyIndividual")]
...would take car of the lower case d, but I guess not. But if not, what does this attribute do?
Also, why does umbraco generate the property with an upper case D when the property alias in the document type has a lower case d?
The attribute denotes the property represents that alias on the doctype. It’s there because you can extend these classes with your own properties and override the generated ones.
You can see more info about the attributes here:
https://github.com/zpqrtbnk/Zbu.ModelsBuilder/wiki/ModelsGenerationConfiguration
The reason the property starts with an uppercase D is down to naming conventions. All the API properties start with capitals like .Name or .Url — so the generated ones do too.
Hope that helps :)
is working on a reply...