I think the name is pretty clear, but give a little context.
I read this question, but it doesn't quite match my use case
Intercept-sql-statements-containing-parameter-values-generated-by-nhibernate
The problem I am facing is that I want to exit the generated SQL only when an exception occurs (or the time period expires). This will allow us to eliminate some lengthy requests in a very complex application. I do not want to intercept and record all requests, since, in my opinion, this will be a hit on performance.
The moment I want to register it, I have an ICriteria object that uses NHibernate, so what I'm looking for is a kind of “dummy” NHibernate object with which I can run this ICriteria and return an SQL string (or even SQL with placeholders for parameters and a list of parameters).
So, there is something that does this (I think it is either incredibly simple and I missed something, or it is very difficult and no one needs it).
If this does not exist, then the best way to do something that achieves the goal, without manually creating SQL (I want as close to executable SQL as possible). Is there a way to go straight to the NHibernate generator and get a string?
Add to this to make it more understandable.
I want to do this "After the fact", and not intercept every request (due to performance issues). I also do not want to do this with Log4Net, since I need it to register against the session.
I think there should be a way to create a second NHibernate object that can use a different driver (one that does not go to the database), so I can implement a way to intercept this object and not the main object that is stored in the database