Microsoft Sync Framework error deleting foreign key linked tables
I am using Microsoft Sync Framework 2.1 with SqlServerCE. I h开发者_JAVA百科ave a main table with a child table linked by a foriegn key. When I delete the main table entry, it fails since there are items in the child table (which have also been deleted.)
How do I tell Sync what order to delete rows from tables in?
The order in which you are syncing tables matters. When you are dealing with parent/child relationships you must make sure to specify the child elements first and then the parents. For the project I implemented Sync Framework, we simply had the child and parent table each in their own SyncScope, and had the child scope done before the parent scope since having two tables in ordered correctly in the same scope did not seem to guarantee order.
精彩评论