我想我发现了一个错误,为此我准备了一个小测试(基于 DocCode 项目):
test("all customers (concise)", 1, function () {
var realEm = newEm();
var metadataStore = realEm.metadataStore; // model metadata known to this EntityManager
var orderType = metadataStore.getEntityType("Order"); // metadata about the Customer type
var newOrder = orderType.createEntity(); // call the factory function for the Customer type
realEm.addEntity(newOrder);
newOrder.CustomerID("729de505-ea6d-4cdf-89f6-0360ad37bde7");
var items = realEm.rejectChanges();
var query = EntityQuery.from("Customers")
.where("CustomerID", "==", "729de505-ea6d-4cdf-89f6-0360ad37bde7")
.expand("Orders");
stop();
realEm.executeQuery(query)
.then(function (data) {
console.log(data);
/*SELECT OrderID, CustomerID, EmployeeID, OrderDate, RequiredDate, ShippedDate, Freight, ShipName, ShipAddress, ShipCity, ShipRegion, ShipPostalCode, ShipCountry,
RowVersion
FROM[Order]
WHERE(CustomerID = '729de505-ea6d-4cdf-89f6-0360ad37bde7')*/
ok(data.results[0].Orders().length == 10, "The customers must have 10 Orders")
})
.fin(start);
});
如您所见(执行注释查询)客户必须有 10 个订单,但返回的数组有 11 个。
我是对的还是我做错了什么?