Reputation: 6702
I'm looking at the nhibernate interceptor. It seems to be able to intercept save, update and delete queries but is there anyway I can intercept a select query.
The problem I have is that I automatically want to append some additional sql filters to the executing sql statement in certain cases.
Any thoughts
Thanks Mat
Upvotes: 3
Views: 1498
Reputation: 13839
You can use the where
attribute on the class
tag:
<class name="MyClass" where="deleted=0">
...
</class>
Upvotes: 0
Reputation: 5338
I think you can accomplish that with a custom NHibernate persister; however, I'm having trouble finding examples on how you'd write one...
Upvotes: 0
Reputation: 247
The interceptor framework only allows you to intercept entity operations like save, update, and delete. Queries themselves aren't intercepted, only entity operations (and selecting/viewing doesn't count).
Consider using some sort of inheritance for a set of query classes that append to your ICriteria to suit your purposes.
Upvotes: 2