Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/excel/24.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# NHibernate统计查询不可见_C#_Nhibernate - Fatal编程技术网

C# NHibernate统计查询不可见

C# NHibernate统计查询不可见,c#,nhibernate,C#,Nhibernate,我正在尝试为我的应用程序使用nHibernate istatics。我有一些这样的代码 IStatistics stats = GetSessionFactory().Statistics; var queryCount = stats.QueryExecutionCount; var queries = stats.Queries; queryCount中填充了查询数的值,但查询字符串数组始终为空。这有什么原因吗?我正在使用NHibernate 3.0。在运行任何查询之前,请执行以下操作:

我正在尝试为我的应用程序使用nHibernate istatics。我有一些这样的代码

IStatistics stats = GetSessionFactory().Statistics;
var queryCount = stats.QueryExecutionCount; 
var queries = stats.Queries;

queryCount中填充了查询数的值,但查询字符串数组始终为空。这有什么原因吗?我正在使用NHibernate 3.0。

在运行任何查询之前,请执行以下操作:

stats.IsStatisticsEnabled = true;
执行此操作后,将显示以下代码:

session.CreateQuery("from Foo").List();
Console.WriteLine(stats.Queries[0]);
…将打印“来自Foo”


只存储HQL查询(也存储LINQ,但只有字符串不是很有用)

谢谢,但似乎不起作用。iStatistics中的查询列表仍未填充。其他的统计数据似乎也在起作用。@Craig:对我来说效果很好,我刚刚测试过(见添加的示例)。你用的是什么版本?你有什么疑问?此属性仅包括HQL和LINQ。这可能是问题所在,我使用的是ICriteria。请在回答中添加以下内容:查询仅由HQL和LINQ(旧版本)填充,我将标记为正确。