How do I implement an Interceptor that outputs the query WITH parameters? I have searched the web and stackoverflow for a long time now and haven´t found an answer to my problem. My Custom Interceptor-Class looks like this at the moment:
public class SQLDebugOutput : EmptyInterceptor, IInterceptor {
public override NHibernate.SqlCommand.SqlString OnPrepareStatement(NHibernate.SqlCommand.SqlString sql) {
System.Diagnostics.Debug.WriteLine("NH: " + sql.ToString());
return base.OnPrepareStatement(sql);
}
}
The parameters in the query are displayed as questionmarks though and I need them for debugging purposes. Also I´d prefer a solution not using the Log4Net Logger.
So, is it possible at all to retrieve the parameter values of a query using an interceptor at all? Maybe by overriding other methods of it?