When working in razor do you use: DynamicNode or INode?
Hi Everyone.
I'm wondering how many people are using DynamicNode in thier razor scripts vs how many are using strongly typed nodes?
I started out doing everything with DynamicNode which does some things better, but end up converting nodes to INodes for all the convenince methods I have written (and uQuery ones)
I just like using the "pure" implementation, so I use DynamicNode (or, even more vague: dynamic). That way I know I have all of the operations I want (like Descendants(), Children, Parent, Next(), Previous() etc.) without running into compile issues.
For loads of examples, have a look at my Razor Examples package, it uses dynamic everywhere and hardly ever does any static typing. I found that once you get used to this way of working and have plenty of examples on file, it gets really easy to do everything without having to do loads of casting.
I do like uQuery and UQL, but I haven't really found a "killer" feature in them, I don't want to add another dll when the out-of-the-box experience is fine for me (personally).
That said, I know loads of people love the safety net of having code completion with static types and that's great, go for it! Just know there's alternative ways. :-)
Hmm, well, I would say that's a bit annoying but there might be a good reason for this behaviour. I never really get invalid nodeId's in there though, so it's not a problem for me.
A workaround could be to test if myNode.Name == string.Empty. That should never happen in real life, all nodes should have a name.
When working in razor do you use: DynamicNode or INode?
Hi Everyone.
I'm wondering how many people are using DynamicNode in thier razor scripts vs how many are using strongly typed nodes?
I started out doing everything with DynamicNode which does some things better, but end up converting nodes to INodes for all the convenince methods I have written (and uQuery ones)
What are your pain pionts with either aproach?
Cheers.
Murray.
I just like using the "pure" implementation, so I use DynamicNode (or, even more vague: dynamic). That way I know I have all of the operations I want (like Descendants(), Children, Parent, Next(), Previous() etc.) without running into compile issues.
For loads of examples, have a look at my Razor Examples package, it uses dynamic everywhere and hardly ever does any static typing. I found that once you get used to this way of working and have plenty of examples on file, it gets really easy to do everything without having to do loads of casting.
I do like uQuery and UQL, but I haven't really found a "killer" feature in them, I don't want to add another dll when the out-of-the-box experience is fine for me (personally).
That said, I know loads of people love the safety net of having code completion with static types and that's great, go for it! Just know there's alternative ways. :-)
this is one of the biggest problems with DynamicNode imo:
http://umbraco.codeplex.com/workitem/30459
Hmm, well, I would say that's a bit annoying but there might be a good reason for this behaviour. I never really get invalid nodeId's in there though, so it's not a problem for me.
A workaround could be to test if myNode.Name == string.Empty. That should never happen in real life, all nodes should have a name.
is working on a reply...