score:1

Accepted answer

consider to rewrite your query until this bug is fixed

var sourceqery = repository.commentresponses;

var groupingquery = 
    from responses in sourceqery
    group responses by responses.commentid into responsegroup
    select new 
    {
        commentid = responsegroup.key,
        responsecount = responsegroup.count()
    };

var commentresponses = 
    from g in groupingquery
    from latestcomment in sourceqery
        .where(l => l.commentid == g.commentid)
        .orderbydescending(a => a.originalcreatedtime)
        .take(1)
    join user in repository.users on latestcomment.userid equals user.id
    select new commentresponsedata
    {
        commentid = g.commentid,
        lastresponsetime = latestcomment.originalcreatedtime,
        responsecount = g.responsecount,
        lastresponseby = user.fullname,
        lastresponsemessage = latestcomment.body,
    };

Related Query

More Query from same tag