NHibernate Pitfalls: Get and Filters
This is part of a series of posts about NHibernate Pitfalls. See the entire collection here.
This was suggested a long time ago by Kelly Brownsberger (@kbrowns). What happens is, even if you have filters defined, they are not applied on a call to ISession.Get<T>(). This is by design: you are explicitly asking for an entity with some id, so NHibernate just returns you that. On the other hand, static where restrictions defined at the entity level still apply.