我正在尝试使用.Include()让RavenDb执行单个请求,但是在使用异步方法时我会收到多个请求。
public class List
{
public Guid Id { get; set; }
public List<string> Items { get; set; }
}
public class ListItem
{
public Guid Id { get; set; }
}
List.Items是Id引用Item文档的集合。
var session = store.OpenSession();
var listId = new Guid("181aaacd-6505-4a49-96a8-c2da5abb426a");
var list = session.Include<List, ListItem>(bp => bp.Items).Load<List>(listId);
return session.Load<ListItem>(list.Items);
正确地给出了
Request # 412: GET - 2 ms - listdb - 304 - /queries/?&include=Items(Item/)&id=Lists%2181aaacd-6505-4a49-96a8-c2da5abb426a
var session = store.OpenAsyncSession();
var listId = new Guid("181aaacd-6505-4a49-96a8-c2da5abb426a");
var list = await session.Include<List, ListItem>(l => l.Items).LoadAsync<List>(listId);
return await session.LoadAsync<ListItem>(list.Items);
生成2个不是我期望的请求
Request # 1: GET - 0 ms - listdb - 304 - /queries/?include=Items(Item/)&id=Lists%22181aaacd-6505-4a49-96a8-c2da5abb426a
Request # 2: GET - 0 ms - listdb - 304 - /queries/?&id=Items%2F3d75a8d6-a12d-4dd7-8c35-4e093a66adaa
这是预期的吗? 异步问题?
Raven Build 2951,版本2.5.0 / 6dce79a