How to fix my Merge Replication upload order?
There are cases in Merge Replication when parent and child rows can be processed out of order on synchronization resulting in constraint violations and conflicts.

To understand how and why this can occur and how it may apply to your specific scenario, I recommend reading through:


How to understand Merge Replication article processing order
Merge Article Processing Order and using the "Not for Replication" Attribute


To immediately alleviate the constraint violations and conflicts from occurring on synchronization you can mark the foreign keys as NOT FOR REPLICATION.  This means that the foreign key constraint will not be enforced when the Merge Agent performs an operation.  To mark the foreign key constraint as NOT FOR REPLICATION please see Controlling Constraints, Identities, and Triggers with NOT FOR REPLICATION.

Another approach is to increase -UploadGenerationsPerBatch and the -DownloadGenerationsPerBatch Merge Agent parameters to avoid splitting parent and child changes across generation batches.