Hello,
I join a screenshot. I have a Customer table and a Risk (with 4 rows) table, each customer is associate to a risk.
1. First transaction, I get the list of customer
2. I select one, to see detail, I get the list of risk to display in a dropdown
3. Thirs transaction, back to the list of customer
4. I select an another one, now I see Nhibernate use the cache. The question is : is it normal I have 4 queries to the risk table. On the fourth NHProfiler warn me (N+1)
I did something wrong ?
Thanks,
Implementation I use :
1. In the web.config, in the configSections : <section name="syscache" type="NHibernate.Caches.SysCache.SysCacheSectionHandler, NHibernate.Caches.SysCache" />
2. <syscache>
<cache region="SomeCustomNameRegion" expiration="86400" priority="5" />
</syscache>
3. The query :
public IList<Risk> GetListRisk()
{
return Session.QueryOver<Risk>()
.Cacheable()
.CacheMode(CacheMode.Normal)
.CacheRegion("SomeCustomNameRegion")
.List<Risk>();
}