I'm trying to show the SQL in the console of Visual Studio but it doesn't work. I'm using fluent nhibernate with the following code:
string connectionString = WebCondStaClara.Lib.ConfigDB.StringConexao;
ISessionFactory sessionFactory = Fluently.Configure()
.Database(
MySQLConfiguration.Standard.ConnectionString(connectionString).ShowSql
)
.Mappings(m =>
m.FluentMappings
.AddFromAssemblyOf<Person>()
.AddFromAssemblyOf<Home>()
)
.ExposeConfiguration(cfg => new SchemaExport(cfg)
.Create(true, false)).BuildSessionFactory();
return sessionFactory.OpenSession();
What am I doing wrong?
(Fluent)NHibernate uses log4net to provide logging support. You have to configure log4net appropriately (build up a configuration with a console, debug or trace appender and let the loggers use these appenders).
Have a look here: How to log SQL calls with NHibernate to the console of Visual Studio?