I have the following mapping in Fluent-NHibernate Map
public class PostMap : ClassMap<Post>
{
public PostMap()
{
Id(i => i.Id).GeneratedBy.GuidComb();
Map(x => x.SiteId);
Map(x => x.Message);
Map(x => x.DateCreated);
Map(x => x.DateModified);
HasMany(x => x.Comments)
.OrderBy("DateCreated DESC")
.ReadOnly()
.Not.LazyLoad();
}
}
There are a lot of comments on each post, what I would like to do is only bring back the top 5 from the db rather than remove them in code.
Should be possible with filters. Read here: http://nhibernate.info/doc/nh/en/index.html#filters