Reputation: 1541
Immediately after my datacontext.savechanges I stop the code and use the Chrome dev tools inspector to look at the XHR request that just ran. This is what I see:
$type: "Breeze.WebApi.SaveResult, Breeze.WebApi"
Entities: [{$id:2, $type:pdb.productMaster, PDB, Id:1912, ProductCode:a18, Description:a18t, GroupId:116}]
0: {$id:2, $type:pdb.productMaster, PDB, Id:1912, ProductCode:a18, Description:a18t, GroupId:116}
$id: "2"
$type: "pdb.productMaster, PDB"
ProductCode: "a18"
ProductVersions: null
Description: "a18t"
GroupId: 116
Id: 1912
Errors: null
I then go straight to SQL Management Studio and look at the just-added record:
Id ProductCode Description GroupId
1912 a18 a18t 1
Yup, every single record I'm adding has groupID set to 1! It is an int field. I can manually set it to 116 in SQL Management studio.
The response from the XHR request also shows no errors and says the groupID is 116.
I have absolutely no idea what is going on here! Breeze error? It's totally bizarre.
Upvotes: 0
Views: 35
Reputation: 17052
I'd start by looking at the metadata for your "productMaster" entity type. You can use Breeze's MetadataStore.getEntityType method and then investigate the data and navigation properties. My guess is that this might give you more insight into the issue... possibly a mismatch between your client and server code.
You can also create a save interceptor on the server and investigate what the server side entity looks like when materialized on the server just before the save.
Upvotes: 2