How to configure Fluent NHibernate to output queries to Trace or Debug instead of Console?
I\'m using MsSqlConfiguration.MsSql2008.ShowSql() but it has no param
I have not tried this with SQL Server, but with SQLite, the following code will show generated SQL in the Output window (Debug menu -> Windows -> Output, in VS2008).
The "Show output from:" combo box in the Output window should be set to "Debug" - VS2008 did that for me automatically.
sessionFactory = Fluently.Configure()
.Database(SQLiteConfiguration.Standard
.UsingFile(DbFile)
// Display generated SQL in Output window
.ShowSql()
)
.Mappings(m => m.AutoMappings.Add( GetAutoPersistenceModel() ))
.BuildSessionFactory()
;
A word of warning - turning this on can slow down execution considerably.