-
I've implemented the framework into my code after doing some testing with the Todo demo, and I'm getting an exception when pushing my table with a single row. I get a conflict telling me the Primary Key is a duplicate. Is it supposed to push the same row every push, even though it already exists at the server ? I'm fairly sure I've setup correctly, my client models inherit Any pointers ? EDIT: so after tracing the code in the SDK, I see the client stores errors in the db and this will explain why I get this exception without a server, but how did it happen with only a single row and a single insert. Just to clarify the row I inserted on the client has appeared on the server and looks fine. |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 5 replies
-
You would get that sort of conflict by: a) Doing a CreateAsync on the client and inserting the same data in the server If Push cannot create the item, you have to do something with the queued item - cancel and update, cancel and discard - you can't just expect it to silently ignore the item. |
Beta Was this translation helpful? Give feedback.
-
Did you do a pull afterwards? Generally, you want to make the table a singleton. The client has to be a singleton (it holds the SyncContext, which also has to be a singleton because that's what holds onto the database connection). |
Beta Was this translation helpful? Give feedback.
-
So I have spent some time and gone over the code and have fixed the issue of the duplicate key, but now after sync I end up with a duplicate on the client, no exceptions though. I can work offline and create the record on the client and its is not duplicated, but after a sync, the server contains 1 record but the client has 2 but oddly they seem to have the same Id. |
Beta Was this translation helpful? Give feedback.
-
I 've worked out what is going on. It had to do with the way the Id's are stored in Sqlite. Some times the Id was stored with or without hyphens in the Guid string. |
Beta Was this translation helpful? Give feedback.
I 've worked out what is going on. It had to do with the way the Id's are stored in Sqlite. Some times the Id was stored with or without hyphens in the Guid string.