有没有办法告诉RavenDb对某些DocumentStore或DocumentSession的所有查询使用WaitForNonStaleResults模式?
答案 0 :(得分:10)
您可以在DocumentStore或会话级别使用DefaultQueryingConsistency = ConsistencyOptions.QueryYourWrites
。
<强> DocumentStore:强>
IDocumentStore store = new DocumentStore {
Url = "http://127.0.0.1:8080",
DefaultDatabase = "DBNAME",
Conventions = {
DefaultQueryingConsistency = ConsistencyOptions.QueryYourWrites
}
}.Initialize();
<强>会话强>
session.Advanced.Conventions.DefaultQueryingConsistency =
ConsistencyOptions.QueryYourWrites;
请记住,此机制不适用于Map-Reduce Indexes
您可以在下面检查Matt's对此问题的评论