In our Ordering.Console application of Chapter 5, The Session Procession, we were able to query data out of the database using a ICriteria
object. We saw that NHibernate returned the data we asked for, but what if we wanted to know more? How do we see the SQL that was actually generated? Let's add some logging to our console application to show us the SQL that NHibernate generates.
Open the References folder of the Ordering.Console application. Is the log4net dll already referenced? If not, then right-click on References, click Add Reference, and browse to the
log4net.dll
that was included with the NHibernate release.Right-click on the Ordering.Console application, and select Add | New Item. Select Application Configuration File, leave the name as
App.config
, and click on the Add button, as shown in the following screenshot:The first thing we need to add to our
App.config
file is a<configSections>
tag inside the<configuration>
section, with...