Help: NHibernate and SysCache2 [modified]
-
Hi there, i want to know how to setup to nhibernate for use the SysCache2 in my AspNet 2.0 Application... this is what i have been doing, in the web.config:
NHibernate.Dialect.MsSql2005Dialect NHibernate.Connection.DriverConnectionProvider server=XXXX;database=XXXX;uid=XXXX;password=XXXX;Max Pool Size=100;Enlist=False true true NHibernate.Caches.SysCache2.SysCacheProvider,NHibernate.Caches.SysCache2 And in my class i do the following: public static IList GetCountryList() { string sql = "from Model.Country c Order By c.Countryid"; IQuery query = Base.Session().CreateQuery(sql); query.SetCacheable(true).SetCacheRegion("nhibernate.country.countrylist"); IDictionaryEnumerator e = HttpContext.Current.Cache.GetEnumerator(); while (e.MoveNext()) { //The first time nothing happen here //After that the System.Web.HttpContext.Current.Cache.Count is 2 //How can i get the cached collection?? object o = e.Current; object k = e.Key; object v = e.Value; } return query.List(); } Any help would be appreciated. Bye. p.d:oops, its the c# forum, my code was in vb net, now is in the right language :) -- modified at 18:32 Tuesday 2nd October, 2007