What Im trying to do is this: http://www.janblaha.net/blog/nhibernate-multitenancy-in-shared-database
This is my filter definition:
public class MultitenancyFilter : FilterDefinition
{
public MultitenancyFilter()
{
WithName("multitenancy").WithCondition("TenantId= :tenantId").AddParameter("tenantId", NHibernate.NHibernateUtil.Int32);
}
}
Then, I do my query like this:
_session.EnableFilter("multitenancy").SetParameter("tenantId", tenantId);
var people = _session.QueryOver<Person>().List().ToList();
where tenantId is some int.
But the NHibernate never generates the filter in the query. The query is generated without 'where' clausure at all.
Am I missing some configuration or some concept?
NHibernate Version 4.0.0.4000.
PS. When debuggin, the _session has a property called EnabledFilter, and my filter is listed there. So, whats wrong?