I have two lists, Posts and Comments. Comments has a Lookup column to the Posts list, and the Posts has a Lookup (Count Relate) relationship back to the Comments list. What I'm trying to do is just display the number of Comments in each Post. For some reason I can't get how to do this with the Entity References.
I have an ArchiveItem class:
public class ArchiveItem
{
public string Id { get; set; }
public string Title { get; set; }
public string Comments { get; set; }
public string Date { get; set; }
}
And then the query that I'm trying to run:
var queryItems = from item in spotlightItems
join comment in commentItems on item.Title equals comment.Title
select new ArchiveItem
{
Id = item.Id.ToString(),
Title = item.Title,
Comments = comment.Post.Title.Count().ToString(),
Date = item.Date.ToString()
};
I've tried a few different ways and get a variety of error messages. This particular version gives me
The query uses unsupported elements, such as references to more than one list, or the projection of a complete entity by using EntityRef/EntitySet.
Any ideas? I thought this would be pretty simple, but maybe I'm missing something.