Configuring NHibernate to display executed SQL does what it\'s supposed to, but whenever a SQL string needs to be copy-pasted into SQL Server Management Studio, we have to r
I haven't used this in a while but I believe using an interceptor would fit your criteria.
using NHibernate;
using System.Diagnostics;
public class SqlStatementInterceptor : EmptyInterceptor
{
public override NHibernate.SqlCommand.SqlString OnPrepareStatement(NHibernate.SqlCommand.SqlString sql)
{
Trace.WriteLine(sql.ToString());
return sql;
}
}
Credit goes to user mindplay.dk
here.