public IList<Post> PostsForCategory(string categorySlug, int pageNo, int pageSize)
{
var query = _session.Query<Post>()
.Where(p => p.Published && p.Category.UrlSlug.Equals(categorySlug))
.OrderByDescending(p => p.PostedOn)
.Skip(pageNo * pageSize)
.Take(pageSize)
.Fetch(p => p.Category);
query.FetchMany(p => p.Tags).ToFuture();
return query.ToFuture().ToList();
}
但是,我使用實體框架,而不是NHibernate的,但的EntityFramework沒有任何定義Fetch
或FetchMany
!我如何用Entity框架來做到這一點?