Just a follow up.  I've tried changing the above to:

public IQueryable<T> GetAll(bool cachable) {
    var query = _session.Query<T>();

    if (cachable)
        query.Cacheable().CacheMode(CacheMode.Normal);

    return query;
}

>From within my repository but looking at NHibernate Profiler shows me
that query caching is not working.  The following works fine in
NHibernate 2.12:

public IQueryable<T> GetAll(bool cachable) {
    var query = session.Linq<T>();
 
query.QueryOptions.SetCachable(cachable).SetCacheMode(CacheMode.Nor­
mal);
    retury query;
}

I'd really appreciate it if someone could help as i'm approaching a
project deadline and may have to switch back to the old version unless
this is resolved.  Thanks

On Dec 15, 4:33 pm, nfplee <[email protected]> wrote:
> Hi, if you call:
>
> session.Query<T>().Cacheable().CacheMode(CacheMode.Normal).Single(...);
>
> It throws the error:
>
> "Specified method is not supported."
>
> I assume I have to place the Cacheable bit at the end to get this to
> work.  This is abit of an issue for me as my repository handles the
> cacheable part and I don't wish to expose the Nhibernate extension
> methods outside of my repository.
>
> In the past I simply said:
>
> session.Linq<T>().QueryOptions.SetCachable(true).SetCacheMode(CacheMode.Nor­mal);
>
> And it all worked fine.  I'd appreciate it if someone could let me
> know where this is something that is likely to be fixed soon or an
> alternative way i can achieve this.
>
> Thanks

-- 
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/nhusers?hl=en.

Reply via email to