I think that filters do not apply when you are getting an entity by id (get/load), just when you issue a query using HQL or criteria.
On Mon, Apr 27, 2009 at 12:37 AM, Michal <[email protected]> wrote: > > Thanks fabio for the quick reply. > > Unfortunately this does not work. The filter stays with the same > value. > > See my code. Thanks!: > > ISessionFactory sf = new Configuration().Configure > ().BuildSessionFactory(); > ISession sess = sf.OpenSession(); > sess.EnableFilter("CultureFilter").SetParameter > ("CultureId", new CultureInfo("en-US").LCID); > sess.BeginTransaction(); > > IDaoFactory dao = new NHibernateDaoFactory(); > Question q = (Question)sess.Load(typeof(Question), 4); > > Assert.AreEqual("Whats your name?", q.Text, "English > translation does not work"); > > sess.DisableFilter("CultureFilter"); > sess.EnableFilter("CultureFilter").SetParameter > ("CultureId", new CultureInfo("de-DE").LCID); > q = (Question)sess.Load(typeof(Question), 4); > > Assert.AreEqual("Wie ist dein Name?", q.Text, "German > translation does not work"); > > sess.Transaction.Rollback(); > > sess.Flush(); > sess.Close(); > > On Apr 25, 9:09 pm, Fabio Maulo <[email protected]> wrote: > > disable->enable > > 2009/4/25 Michal <[email protected]> > > > > > > > > > > > > > Hi, > > > > > I am using filters for my session and would like to reload the > > > filter's param value. How to do that? > > > > > I am setting the filter like that > > > > > session.EnableFilter("name").SetParameter("param", 1) > > > > > now i would like to change the value from 1 to 2 for the upcoming > > > queries ... when i just change it to > > > > > session.EnableFilter("name").SetParameter("param", 2) > > > > > then the change is not populated somehow. > > > > > What i am doing wrong? > > > > > Thanks > > > > -- > > Fabio Maulo > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "nhusers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/nhusers?hl=en -~----------~----~----~----~------~----~------~--~---
