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