I'm trying to get the current IPublishedContent from the contentcache in a logic class.
In Umbraco 7 I used to do UmbracoContext.Current.PublishedContentRequest.PublishedContent but this doesn't work in Umbraco 8 anymore.
What is the proper way to do this in Umbraco 8?
And then call the method from the logic file in this controller sending the umbraco helper so I can use it in the logic as: var content = _umbraco.AssignedContentItem;.
Get current IPublishedContent
Hi,
I'm trying to get the current IPublishedContent from the contentcache in a logic class. In Umbraco 7 I used to do
UmbracoContext.Current.PublishedContentRequest.PublishedContent
but this doesn't work in Umbraco 8 anymore. What is the proper way to do this in Umbraco 8?Thanks!
Hi Koen,
Take a look at Sebastiaan posts on this thread: https://our.umbraco.com/forum/umbraco-8/96165-v8-umbracohelpercontent-and-umbracohelpertypedcontent-where-has-it-gone
Hi Carlos,
In the Sebastiaan's post he shows how to get the content by id, I want to get the current content as IPublishedContent.
There is no extension method available in UmbracoContext.ContentCache to get this.
You use the Current UmbracoContext in Umbraco.Web.Composing now i.e.
I ended up using the UmbracoHelper class using DI.
And then call the method from the logic file in this controller sending the umbraco helper so I can use it in the logic as:
var content = _umbraco.AssignedContentItem;
.is working on a reply...