Environment: NHibernate 4.0.0.4000; NHibernate.Caches.SysCache 4.0.0.4000; Web MVC / API 4.5.1; FluentNHibernate 1.4.0.0; VS2013;
I am trying to cache an SQL query on nhibernate ( which works fine without caching ), as you can see:
return Session.CreateSQLQuery(sql)
.AddScalar("Id", NHibernateUtil.Int32)
.AddScalar("Summary", NHibernateUtil.String)
.SetResultTransformer(Transformers.AliasToBean<ProductDto>())
.SetCacheable(true)
//.SetCacheRegion("Long") throws same error regardless of this
.List<ProductDto>()
;
but it continues to throw an ArgumentNullException, see details:
Value cannot be null.
Parameter name: source
at System.Linq.Enumerable.Count[TSource](IEnumerable`1 source, Func`2 predicate)
at NHibernate.Util.ArrayHelper.CountTrue(Boolean[] array)
at NHibernate.Transform.CacheableResultTransformer.Create
...
I tried using a different caching provider, namely NHibernate.Caches.RtMemoryCache, but the error is the same.
In addition, no nhibernate information is logged after the call, since the error appears to occur in a very early state on its pipeline.
Cache Configuration Using Fluent NHibernate:
(OracleClientConfiguration.Oracle10.ConnectionString(connStr).AdoNetBatchSize(20000)).Cache(c => c.ProviderClass<SysCacheProvider>().UseSecondLevelCache().UseQueryCache())
( , ):
INFO 2014-11-03 08:51:33,474 [1 ] NHibernate.Cache.StandardQueryCache - starting query cache at region: NHibernate.Cache.StandardQueryCache
? , , ?
!