Hi macgajos,
This doesn't seen like a bug.
What is happening is that you are calling SetDesignSlotImage twice and the method itself performs a save (which occurs async). So the second time aroud, the entities still haven't been saved, but have already been modified.
Your simplified code using NorthwindIB:
void MainPage_Loaded(object sender, RoutedEventArgs e) {
_mgr.Orders.AsScalarAsync().First(orderOp => {
var order = orderOp.Result;
if (order.EmployeeID != null) {
order.Employee.EntityAspect.Delete();
order.Employee = null;
}
order.Employee = new Employee() { FirstName = "Silvio1", LastName = "Belini1" };
_mgr.SaveChangesAsync(savedArgs1 => {
if (savedArgs1.CompletedSuccessfully) {
MessageBox.Show("saved ok");
} else {
MessageBox.Show(savedArgs1.Exception.Message);
}
});
// second time around
if (order.EmployeeID != null) {
order.Employee.EntityAspect.Delete();
order.Employee = null;
}
order.Employee = new Employee() { FirstName = "Silvio2", LastName = "Belini2" };
_mgr.SaveChangesAsync(savedArgs2 => {
if (savedArgs2.CompletedSuccessfully) {
MessageBox.Show("saved ok");
} else {
MessageBox.Show(savedArgs2.Exception.Message);
}
});
});
}
What exactly are you trying to accomplish by modifying the same entity twice, the second time being while the first SaveChanges call is still pending?
Regards,
Silvio.