我正在使用 RavenDB(在服务器模式下运行 @localhost:3000)和 ASP.NET MVC3
我有这个从 build 289 停止工作的代码段。它之前确实工作过几次,不确定是更新到 322 还是我做了什么。
Session.Query<Post>().ToList().ForEach(Session.Delete);
当我前一阵子尝试时,它正在删除所有帖子(我的示例数据中只有大约 50 个奇怪的帖子,还有 500 多个帖子),我能看到的唯一变化是这两个发生在运行时
A first chance exception of type 'System.Net.WebException' occurred in System.dll
A first chance exception of type 'System.Net.WebException' occurred in Raven.Client.Lightweight.dll
当上面的代码段(Session.Delete)实际运行时,这个日志出现在Visual Studio的输出窗口中
Executing query '' on index 'dynamic/Posts' in 'http://localhost:3000'
Query returned 0/0 results
在 Raven 日志中,(文本文件)没有任何不妥之处
Request # 7: GET - 46 ms - ZaszStore - 200 - /indexes/dynamic/Posts?query=&start=0&pageSize=128&aggregation=None
这个查询运行得很好:
Session.Load<Post>("MyPostId")
并获取正确的 Post Instance。
为什么一个简单的 Session.Query().ToList() 总是返回 0 个结果?并且 Session.Query().Count() 总是返回 0。考虑到 Raven DB 的 SilverLight-UI (SL-UI) 清楚地显示 DB 中有 50 多个帖子,什么可能导致这种行为?
“Raven-Entity-Name”已正确填写。