Hey Rhys - that sure did the trick. Where can I see changes like this without having to dig through every method whenever I'm trying to reuse old code? Thanks for the help!
Whilst it might not be the best solution, generally I've been doing the following to re-factor old code for use in V8:
Looking through the documentation (not 100% updated)
Using the intellisense within Visual Studio to view parameters
Viewing the V8 source on GitHub (pulling it down locally makes debugging easier, so I'd recommend that).
Admittedly, I'm still getting used to things, but that's what's been working for me at the moment. It's not a super-quick way of doing things, but hopefully it's of some use to others.
Yeah, obviously using intellisense within Visual Studio is the best way when the documentation is so incomplete. Also a good idea to have the V8 Source on hand when in doubt. I just really wish there was a complete documentation overview of what's changed from v7 to v8, but I guess nobody has that complete overview in a sharable format ;-)
I just had a look at the docs for the IPublishedContent Collections and I've been unable to find anything about the DescendantsOfType.
Am I daft or...
I'm doing this to get all the descendants of type "hotelOffer" on my Umbraco 8 website:
Umbraco.ContentAtRoot().First().Descendants("hotelOffer")
Problem is I'm only getting one node; the front-page of the website, which isn't even of the type "hotelOffer". What's going on?
kthxbye!
In V8, the
Descendants()
method gets the descendants by culture. As such, since there's no "culture" calledhotelOffer
, the results will be incorrect.Instead, you could use
DescendantsOfType()
, which accepts a contentType and a culture (if required).The following code should work:
Hey Rhys - that sure did the trick. Where can I see changes like this without having to dig through every method whenever I'm trying to reuse old code? Thanks for the help!
I'm glad that worked for you!
Whilst it might not be the best solution, generally I've been doing the following to re-factor old code for use in V8:
Admittedly, I'm still getting used to things, but that's what's been working for me at the moment. It's not a super-quick way of doing things, but hopefully it's of some use to others.
Yeah, obviously using intellisense within Visual Studio is the best way when the documentation is so incomplete. Also a good idea to have the V8 Source on hand when in doubt. I just really wish there was a complete documentation overview of what's changed from v7 to v8, but I guess nobody has that complete overview in a sharable format ;-)
I just had a look at the docs for the IPublishedContent Collections and I've been unable to find anything about the DescendantsOfType.
Thanks again, Rhys - you're a legend!
is working on a reply...