Getting IPublishedContent from the new Relations Service
Using the new ApplicationContext.Current.Services.RelationService, I'm not seeing any way of retrieving IPublishedContent object sets. I see that it's possible to get IUmbracoEntity enumerables, but aren't these the slower read / write objects, like the Umbraco.Core.Models.ContentType?
Is there some way of easily getting IPublishedContent object sets?
Here is my solution (Blog Example). I extracted this method out of the controller and use in in a "Helper" class:
private static IEnumerable<BlogArticle> RelatedArticles(int id)
{
var umbracoHelper = new Umbraco.Web.UmbracoHelper(UmbracoContext.Current);
IList<BlogArticle> list = new List<BlogArticle>();
var service = ApplicationContext.Current.Services.RelationService;
foreach (var relation in service.GetByParentId(id))
{
list.Add(new BlogArticle(umbracoHelper.Content(relation.ChildId)));
}
return list;
}
Getting IPublishedContent from the new Relations Service
Using the new ApplicationContext.Current.Services.RelationService, I'm not seeing any way of retrieving IPublishedContent object sets. I see that it's possible to get IUmbracoEntity enumerables, but aren't these the slower read / write objects, like the Umbraco.Core.Models.ContentType?
Is there some way of easily getting IPublishedContent object sets?
This is old... not so good that it doesn't have a reply. I'm on 7.6.3 and ran into the same issue.
Trying to figure it out now.
FYI: I'm in controller.
Here is my solution (Blog Example). I extracted this method out of the controller and use in in a "Helper" class:
is working on a reply...