I understand that this cannot exactly solve your problem, but it can be done if you connect your objects through an IOC container or if you have one point at which you are creating a session.
How I handled this when activating ISession. I switched the filter by default (using Autofac):
builder.RegisterAdapter<ISessionFactory, ISession>(factory => factory.OpenSession())
.InstancePerHttpRequest()
.OnActivated(activatedArgs =>
{
var session = activatedArgs.Instance;
session.EnableFilter(MyCustomFilter.Name);
session.BeginTransaction();
});
source
share