qinking126
qinking126

Reputation: 11895

nhibernate 3.2 how to turn off show_sql

I am using nhibernate 3.2, I dont know by default show_sql is turned on or off, but decided to turn it off in my configuration anyway.

I dont know how to turn show_sql off, but I have following 2 lines in my configuration file. are they the same?

db.LogFormattedSql = false;

db.LogSqlInConsole = false;

    public static Configuration Initialize()
    {
        var configuration = new Configuration();

        configuration
            .Proxy(p => p.ProxyFactoryFactory<DefaultProxyFactoryFactory>())
            .DataBaseIntegration(db =>
            {
                db.ConnectionStringName = "test";
                db.Dialect<MySQLDialect>();
                db.KeywordsAutoImport = Hbm2DDLKeyWords.AutoQuote;
                db.LogFormattedSql = false;
                db.LogSqlInConsole = false;
            })
            .AddAssembly(typeof(User).Assembly)
            .CurrentSessionContext<LazySessionContext>();

        var mapper = new ConventionModelMapper();
        mapper.WithConventions(configuration);

        return configuration;
    }

Upvotes: 1

Views: 1142

Answers (1)

Diego Mijelshon
Diego Mijelshon

Reputation: 52735

LogSqlInConsole enables or disables SQL console logging.

LogFormattedSql enables or disables formatting of that SQL.

Upvotes: 3

Related Questions