English 中文(简体)
如何阅读视力演播室中NHibernate生成的薄片
原标题:How to read sql generated by NHibernate in Visual Studio

According to what I know, there are 3 ways to read the sql script generated by NHibernate: 1. log4net 2. sql profiler 3. show_sql = true

在此,我只想谈谈第3次,因为我说,我可以读一下视力演播室产出窗口中的 s。 但无论我做什么,我都看不到什么?

Becasue some guy女士说,“show_sql = real”仅仅是指“Console.WriteLine()”,因此,我提出一个问题:here

I have to say I don t get what I want, so here I summarize my questions: in the output window in an web application:

  1. Can the result of "Console.WriteLine()" be shown?
  2. Can "show_sql=true" make the sql script be shown?

如果是,如何?

最佳回答

我不会有视力演播室,为某类图书馆或网站项目展示青.素产出。 我所做的是将NHibernate sQ编成文字文件,然后在视觉演播室上打开文件。 有了正确的配置,VS将在窗口上点击,显示档案的最新情况。

在您的网页上.config(或参会)界定了标志4net部分,拥有NHibernate Format QQ n,创建了文本文档发送器,并直接传达了NHibernate电文:

<configuration>
  <configSections>
    <section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net" />
  </configSections>

  <hibernate-configuration xmlns="urn:nhibernate-configuration-2.2">
    <session-factory>
      <property name="format_sql">true</property>
    </session-factory>
  </hibernate-configuration>

  <log4net>
    <appender name="NHibernateLogFile" type="log4net.Appender.FileAppender">
      <file value="../Logs/NHibernate.log" />
      <appendToFile value="false" />
      <lockingModel type="log4net.Appender.FileAppender+MinimalLock" />
      <layout type="log4net.Layout.PatternLayout">
        <conversionPattern value="%date{HH:mm:ss.fff}%m%n==========%n" />
      </layout>
    </appender>

    <logger name="NHibernate" additivity="false">
      <level value="WARN" />
      <appender-ref ref="NHibernateLogFile" />
    </logger>
    <logger name="NHibernate.SQL" additivity="false">
      <level value="DEBUG" />
      <appender-ref ref="NHibernateLogFile" />
    </logger>
  </log4net>
</configuration>

然后,NHibernate开放。 视频演播室记录。 由于上述小型Lock,视觉演播室可以阅读文件,同时将日志4net书写给它。 当你在窗口中点击时,VS将重载档案。 当你部署网站或申请时,肯定会这样做。

问题回答

暂无回答




相关问题
Calling Console.WriteLine before allocating the console

I ve recently encountered the following problem with my application: it didn t show any console output, though the console had been allocated by using AllocConsole. I managed to figure out soon that ...

C# CodeDom Console.WriteLine + MethodReference

I am attempting to create a Console.WriteLine statement (shown below) using CodeDom. This is giving me mainly because of the Environment.NewLine call - I can t figure out the proper way of embedding a ...

Is console.writeline thread safe? [duplicate]

Possible Duplicate: Calling Console.WriteLine from multiple threads Just want to know if multiple threads call Console.WriteLine, will it cause a deadlock?

question about print List<T> to screen

A question about List; When i have "List<PlugwiseMessage> msg" with the value s from the picture : I only get PlugwiseLib.BLL.BC.PlugwiseMessage as output. But how can i see the value s from ...

热门标签