我在 localhost:8080 上运行 RavenDB 服务器。我在那里创建了一个数据库“CountriesRegions”,其中包含“Country”和“Region”的文档,例如:
文件编号 27:
{
"Country": "Sweden",
"Region": "EU"
}
我有一CountryRegion
堂课:
public class CountryRegion
{
public string Id { get; set; }
public string Country { get; set; }
public string Region { get; set; }
public CountryRegion(){}
}
以下代码包含一个设置为“Sweden”并设置为“EU”的test
对象,如预期的那样:Country
Region
using (var session = _countriesDocumentStore.OpenSession())
{
var test = session.Load<CountryRegion>("27");
}
但是,在此代码test
中是一个空列表:
using (var session = _countriesDocumentStore.OpenSession())
{
var test = session.Query<CountryRegion>()
.Customize(cr => cr.WaitForNonStaleResults())
.ToList();
}
怎么了?