开发者

NHibernate 3 Linq query caching

I've just started using LINQ with NHibernate in NHibernate 3, after previously using ICriteria.

Here's an example query:

ISession session = NHibernateSessionManager.Instance.GetSession();

var results = from project in session.Query<Project>()
              where project.ProjectState == ProjectState.Archive
              orderby project.ProjectNumber开发者_如何学Python
              select project;

return results.ToList();

How do I set that to cache? I've had a look around and other questions seem to use a different (perhaps outdated?) syntax, or perhaps I'm doing it wrong...


Use the Cacheable() extension method on your Queryable before calling ToList().

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜