I am having trouble repeating a blog post when I run the linq statement below.
The problem is that a blog post may have the same tag more than once, and this causes a problem. I know when you use criteria, you can do the following crititeria.SetResultTransformer (new DistinctRootEntityResultTransformer ());
How can I do the same with linq?
List<BlogPost> result = (from blogPost in _session.Linq<BlogPost>() from tags in blogPost.Tags where tags.Tag == tag && blogPost.IsPublished && blogPost.Slug != slugToExclude orderby blogPost.DateCreated descending select blogPost).Distinct() .Skip(recordsToSkip).Take(pageSize).ToList();
linq nhibernate fluent-nhibernate linq-to-nhibernate
user291885
source share