8 stycznia 2011 03:26
I think this could actually be a bug in the 4.0 CTP and I've already worked around it but am interested in your feedback.
I have a table containing phrases (called Phrase) with PhraseID as the primary key. There is a second table called PhraseTag which contains optional additional information about particular phrases. It's a 0..1 join to the Phrases table as a phrase may or may not have a phrase tag but a phrase tag is only ever associated with a single phrase. To facilitate this the PhraseTag table has PhraseID as both it's primary and foreign key joining to the PhraseID in the Phrases table. This all works fine with Sync4.0 UNTIL... you try and insert both a Phrase and it's PhraseTag at the same time. The Upload request goes through fine and actually saves in the server database without a problem, but the server gets an internal error (500) and sends it to the client stating that Multiple entities have the same primary key. The client then doesn't know whether the change has gone through and so continues to send it causing the error message to be sent back until I reset the cache and download the data again.
It seems to me that the check for this is occurring across the different entity types (ie it's looking at all the entities and finding two with PhraseID key with the same GUID, but ignores the fact that they're different entity types).
I've fixed the issue by renaming the PhraseTag primary key to PhraseTagID and reprovisioning and regenerating the entities. I'd really rather have the primary key named PhraseID as that is what it actually is. Happy to further discuss this (although I'm still having issues with Alerts on this forum...).
8 stycznia 2011 19:29Moderator
Can you run a fiddler trace and paste the http response of the request that gave you the 500 status? This will help us troubleshoot the behavior.
SDE, Sync Framework - http://www.giyer.com
- Oznaczony jako odpowiedź przez Sid Singh [MSFT]Microsoft Employee, Owner 27 maja 2011 05:42
1 września 2011 00:20Wow... Just found my own question in response to the same problem I was facing 8 months ago (different tables now but exactly the same concept! Noting that the problem I described is still occurring would it be wiser for me to wait for the IMMINENT release of the code for the Sync Framework 4.0 (at which point I can debug and fix it) or should I go through and rename all my primary keys... ie are we going to see the code very soon? Last post I saw was a couple of weeks ago said end of August (which was yesterday here, but probably still technically correct in the US...).