1
我使用的是nhibernate 3.2,我不知道默認情況下show_sql打開或關閉,但決定在我的配置中關閉它。nhibernate 3.2如何關閉show_sql
我不知道如何關閉show_sql,但我有我的配置文件中的以下兩行。他們是一樣的嗎?
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;
}
謝謝,我猜他們不是一回事,我該如何在我的配置中禁用show_sql? – qinking126 2012-03-31 15:02:10
'LogSqlInConsole = false'應該可以,不過這是默認設置。如果您看到控制檯中的所有SQL,則其他人將其打開(或者有一個log4net配置盲目顯示所有內容) – 2012-03-31 21:44:01
此配置選項位於何處? – 2012-05-23 08:42:33