I tried to get the name to see if I got the right node.
@MyItem.GetProperty("Name").Value
This fails when saving in Umbraco:
'object' does not contain a definition for 'Name' and no extension method 'Name' accepting a first argument of type 'object' could be found (are you missing a using directive or an assembly reference?)
@MyItem.GetProperty("Headline").Value this is the property I'm really interested in but this also fails. This is a TextString defined on the document type.
Bonus question :)
Can I convert umbraco.NodeFactory.Node to DynamicNode?
Ok, I found out how to convert to dynamic. For other people in the future getting here, it's via the constructor of new DynamicNode().
This means that I can get my properties by just dotting.
Are there any advantages/disadvantages of non-dynamic nodes? Should I not just convert to dynamic always (for eaxample after .where clauses with lambda)?
How to get properties of umbraco.NodeFactory.Node
Yes, this should be simple...
<p>type: @MyItem.GetType().ToString()</p>
This returns umbraco.NodeFactory.Node
I tried to get the name to see if I got the right node.
@MyItem.GetProperty("Name").Value
This fails when saving in Umbraco:
'object' does not contain a definition for 'Name' and no extension method 'Name' accepting a first argument of type 'object' could be found (are you missing a using directive or an assembly reference?)
@MyItem.GetProperty("Headline").Value this is the property I'm really interested in but this also fails. This is a TextString defined on the document type.
Bonus question :)
Can I convert umbraco.NodeFactory.Node to DynamicNode?
I can get the name of the node like this of course (it was the node I expected so the other properties exist):
@MyItem.Name
Ok, I found out how to convert to dynamic. For other people in the future getting here, it's via the constructor of new DynamicNode().
This means that I can get my properties by just dotting.
Are there any advantages/disadvantages of non-dynamic nodes? Should I not just convert to dynamic always (for eaxample after .where clauses with lambda)?
is working on a reply...