(IUmbracoContext, UmbracoHelper, IDocumentNavigationQueryService, IDocumentCacheService, async)
I’ve got a variety of content finders and custom controllers that access the content tree. I had been using UmbracoHelper and IUmbracoContextAccessor for most of my needs but in v15 several methods seem to be deprecated.
I have a few questions.
-
Is there somewhere where changes like this are explained and best practices defined? I see new references to a IDocumentNavigationQueryService but am I supposed to start using that everywhere instead? What is the roadmap?
-
This IDocumentNavigationQueryService returns keys, but most of my code needs the content node itself. Should I also be injecting an IDocumentCacheService and then calling GetByKeyAsync? If so, the async in the name makes me worry that I’m hitting the DB now where perhaps I wasn’t before. The async also makes it difficult to call from inside a content finder’s FindContent method which isn’t async.
-
UmbracoContext.Content.GetByRoute() is marked as obsolete now. What is the suggested alternative?
This is a companion discussion topic for the original entry at https://our.umbraco.com/forum/115116-v15-finding-content-a-little-lost-in-the-maze