Reputation: 1167
How can I get same result with NHibernate QueryOver
when using entity framework linq
like this.
var result = items
.include("subEntity1")
.include("subEntity2")
.include("subEntity3")
.where(...).skip(x).take(y);
Upvotes: 2
Views: 1694
Reputation: 123861
A syntax with QueryOver
could look like this:
var query = session.QueryOver<MyEntity>()
// force the collection inclusion
.Fetch(x => x.Collection1).Eager
.Fetch(x => x.Collection2).Eager
...
// force the relations inclusion
.Fetch(x => x.SubEntity1).Eager
.Fetch(x => x.SubEntity2).Eager
...
// paging
.Skip(x)
.Take(y);
var list = query
.List<MyEntity>();
Sources:
Upvotes: 3