I have a function which gets called many times in one session. To my understanding with NHibernate first level cache, exact query in the same session will execute only once irrespective of the number of calls.
Such is not the case though. Below is the snippet and I can see the query being executed in NHProfiler as many times the function is called.
public List<CustomerType> GetAllActiveCustomerTypes()
{
return _unitOfWork.CurrentSession.QueryOver<CustomerType>().Where(x => x.Active).List();
}
Am I missing something in understanding NHibernate here?
Thanks