简体   繁体   中英

Bug related to rejectChanges

I think I found a bug for which I have prepared a small test (based on DocCode project):

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);
});

As you can see (performing the commented query) the Customer must have 10 Orders, but the array returned has 11.

Am I right or am I doing something wrong?

Ok, this was a bug and has been fixed in v 0.84.2. Please give it a try and let us know.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM