Wednesday, March 30, 2011

SetForceCacheRefresh?

How do I re-read some (class) Items from the database? I have read them once and made same updates, updates I dont wont to save. Now I need a complete fresh collection of Items from the database.

I have noticed that there are a function called SetForceCacheRefresh, but how do I use it with a CreateCriteria?

// Mats

From stackoverflow
  • IList list = null; using (Repository rep = new Repository()) { IQuery iqry = rep.Session.CreateQuery(hql);
    iqry.SetForceCacheRefresh(true); list = iqry.List(); }

    Note: Before calling List(), set SetForceCacheRefresh(true) to refresh.

0 comments:

Post a Comment