While upgrading from v14 to v15, I received some obsolete warnings on IPublishedContent properties suggesting to use IDocumentNavigationQueryService and I can’t find an easy way to replace my code with it.
The official documentation still heavily use these obsolete properties, so it’s hard to find how to update the code.
‘IPublishedCache.GetAtRoot(string?)’ is obsolete: ‘Scheduled for removal, use IDocumentNavigationQueryService instead in v17’
See this code, which is used to retrieve the first “blog” node on a site with a single root item: var blogNode = content.GetAtRoot().FirstOrDefault()?.ChildrenOfType("blog")?.FirstOrDefault();
I tried to use IDocumentNavigationQueryService.TryGetRootKeys()
but I don’t know what to do with a Guid key.
IUmbracoContext
methods are always expecting an int id, and no key.
Which service am I missing? Could the obsolete message me updated to include a reference to all services required to obtain an arbitrary content?
Thanks!
This is a companion discussion topic for the original entry at https://our.umbraco.com/forum/115001-v15-obsolete-methods-and-properties-what-are-the-alternatives