entity framework - Maintaining the insert order with Breeze -
edit people stumble upon question in future.
this not breeze issue, ef issue , has been asked many times on so. here , here.
i using breeze knockout. creating entities , pushing them array , when saving changes server data ends in different order how pushed on client. using web api , entity framework.
the javascript code looks this:
var owner = manager.createentity('ownerinformation'); licapp().owners.push(owner); before savechanges called array looks this:

when savechanges called savebundle looks (ommiting lot of other info brevity)
{"entities": [ { "id": 2008, { "id": -3, "licensingapplicationid": 2008, "firstname": "first", "lastname": "owner", }, { "id": -4, "licensingapplicationid": 2008, "firstname": "second", "lastname": "owner", } ]} but after saving database result (the first column id):

why being inserted backwards?
i have higher order question you. why care? you're using relational database. order not defined. if care order, data should have orderby.
i'm not trying snarky. believe expectation of save order sets failure. convince me otherwise. i'm ready learn.
p.s.: don't think breeze has ... on client or server. i'll bet you're using ef. i've never been able predict ef's save order ... nor have bothered try, given principles involved.
Comments
Post a Comment