Access ApplicationContext.Current.Services.ContentService from a Class
I am trying to access ApplicationContext.Current.Services.ContentService from a class to get content and do some modifications to it. I am also trying to access the UmbracoHelper In the Older version I had the following lines of code.
private readonly IContentService _contentService = ApplicationContext.Current.Services.ContentService;
private readonly Umbraco.Web.UmbracoHelper _umbracoHelper = new UmbracoHelper(UmbracoContext.Current);
var content = contentService.GetById(1234);
This is no longer available in Umbraco 8 however I cant find a reference to the new methods to access code from code behind.
Access ApplicationContext.Current.Services.ContentService from a Class
I am trying to access ApplicationContext.Current.Services.ContentService from a class to get content and do some modifications to it. I am also trying to access the UmbracoHelper In the Older version I had the following lines of code.
This is no longer available in Umbraco 8 however I cant find a reference to the new methods to access code from code behind.
I'm not sure if this is how Umbraco intented for us to use it, but you can access them through Umbraco.Web.Composing.Current
Please note I use Umbraco.Web - and not Umbraco.Core. Umbraco.Core does not expose UmbracoHelper.
If you cannot access the namespaces/classes below - please ensure that your web application is running .NET framework 4.7.2 or above
is working on a reply...