开发者

NHibernate 3 Linq query caching

开发者 https://www.devze.com 2023-02-07 12:39 出处:网络
I\'ve just started using LINQ with NHibernate in NHibernate 3, after previously using ICriteria. Here\'s an example query:

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

精彩评论

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