By design.Filters don't work with Get or Load since they mean: I want load
the entity with this ID.
Dynamic filters work with HQL/Criteria and Collection(where enabled for a
collection) only when you use explicit joins or, more general, when the
QuerySpace of a filter match with the QuerySpace of a query.
2008/9/10 Will Shaver <[EMAIL PROTECTED]>
> Noticing some inconsistancies with object loading, and was wondering if any
> of you knew if this was expected behavior or a bug.
>
> I've included a patch for DynamicFilterTest.cs in the FilterTest folder of
> the nhibernate tests, but basically it's like this:
>
> Filters don't seem to work on the primary entity if loaded via
> ISession.Load or ISession.Get. They'll still work on joined entities (marked
> as lazy=false in the hbm). Filters do work via HQL or Criteria
>
> So if I do
>
> session.EnableFilter("Region").SetParameter("Region","THISONEISBAD");
>
> //this returns the Salesperson, but it should not
> session.Get(typeof(Salesperson),id)
>
> //this returns null as expected.
> session.CreateQuery("from Salesperson as s where s.id =
> :id").SetParameter("id",id).UniqueResult();
>
> //this returns null as expected
>
> session.CreateCriteria(typeof(Salesperson)).Add(Restrictions.IdEq(id)).UniqueResult();
>
> So what gives? Is this by design? Should I work to fix this, or is this
> intended?
>
> >
>
--
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
-~----------~----~----~----~------~----~------~--~---