Is there a way to make sure a filter (<filter-def>) in enabled by default as opposed to having to call session.EnableFilter("filter_name") everytime?
I understand this may not exactly solve your issue, but this may be done if you wire your objects via an IOC container or if you have a single point where you create the session.
How I've handled it is on activation of ISession I've toggled 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();
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With