[Test]
public void AutoSyncTest()
{
OrderEntity newOrder = new OrderEntity();
using(DataAccessAdapter adapter = new DataAccessAdapter())
{
RelationPredicateBucket filter = new RelationPredicateBucket();
filter.PredicateExpression.Add(PredicateFactory.CompareValue(CustomerFieldIndex.CustomerId, ComparisonOperator.Equal, "CHOPS"));
newOrder.Customer = (CustomerEntity)adapter.FetchNewEntity(new CustomerEntityFactory(), filter);
Assert.AreEqual("CHOPS", newOrder.CustomerId);
}
}
Although not GUID's, it doesn't matter.
It's important that you illustrate what you're doing so we can try to mimic it here with a more real-world test. The key aspect of syncing is that you use the property which is mapped onto the relation, in this case order.Customer, which I set to a new instance.
Could you paste some code?
The reset of the referenced entity is due to the fact that the order is new: on new entity, all values are accepted, no test is done if the value is the same, to avoid throwing out property set actions which set a field to the same value as the default value.
I see there is a slight flaw in this: when the entity is new, and the field is set AND the new set is the same value, the field shouldn't be set again. I'll see if that has any sideeffects like the one mentioned above. Nevertheless, that's not the root cause of your problem: the sync should work automatically.