I have next entities:
class Topic
{
public virtual int Id {get; private set;}
public virtual ICollection Votes {get; private set; }
}
class
Provided you have a summary class to store your result :
public class SummaryDTO
{
public int TopicId { get; set; }
public VoteType TypeOfVote { get; set; }
public int VoteCount { get; set; }
}
then
Vote voteAlias = null;
SummaryDTO result = null;
youNHSession.QueryOver<Topic>()
.JoinAlias(x=> x.Votes, ()=>voteAlias)
.SelectList(
list=>list
.SelectGroup(topic=>topic.Id).WithAlias(()=>result.TopicId)
.SelectGroup(()=>voteAlias.VotedTo).WithAlias(()=>result.TypeOfVote)
.SelectCount(()=>voteAlias.VotedTo).WithAlias(()=>result.VoteCount ))
.TransformUsing(Transformers.AliasToBean<SummaryDTO>())
.List<SummaryDTO>();
I guess that's not exactly what you are looking for, but hope this will set you on a good track.