Why not just use the fluent model to do this especially since the
class is immutable.

return
Session.Query<TEntity>().Cacheable().CacheRegion(typeof(TEntity).Name).CacheMode(CacheMode.Normal);

On Jun 12, 7:39 pm, "Yoann. B" <[email protected]> wrote:
> Wow!!! My bad ...
>
> I'm a Newbie on this thing ...
> Changed my code to this and all works now :)
>
>         public IQueryable<TEntity> GetQueryable<TEntity>() where
> TEntity : class
>         {
>             var query = Session.Query<TEntity>();
>
>             query = query.Cacheable();
>             query = query.CacheRegion(typeof(TEntity).Name);
>             query = query.CacheMode(CacheMode.Normal);
>
>             return query;
>         }
>
> On 13 juin, 01:36, "Yoann. B" <[email protected]> wrote:
>
> > Hi,
>
> > I've just switch to NH 3.x trunk and i got some caching issues.
>
> > I'm trying to use SysCacheProvider with Session.Query<T>, i configured
> > the cache provider with FluentNHibernate but it still hitting my
> > database... With NH 2.1 cache works fine.
>
> > FluentConfiguration configuration = Fluently.Configure();
>
> > configuration.Database(MsSqlConfiguration.MsSql2008.ConnectionString(_settings.ConnectionString)
> >                                        .Cache(p =>
> > p.UseQueryCache().ProviderClass<SysCacheProvider>())
> >                                        
> > .Dialect<MsSql2008Dialect>().UseReflectionOptimizer()
> >                                        .AdoNetBatchSize(50)
> >                                        .DoNot.ShowSql()
> >                                        
> > .ProxyFactoryFactory<ProxyFactoryFactory>());
>
> >         public IQueryable<TEntity> GetQueryable<TEntity>() where
> > TEntity : class
> >         {
> >             var query = Session.Query<TEntity>();
>
> >             query.Cacheable();
> >             query.CacheRegion(typeof (TEntity).Name);
> >             query.CacheMode(CacheMode.Normal);
>
> >             return query;
> >         }
>
> > Any idea ?
>
> > Thanks.
>
> > Yoann. B

-- 
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