Hi gurus,
I am facing the following problem. With a C# ODATA tool-generated service, I am unable to delete entities, as opossed to create or update. Im am using a fairly simple code:
DataServiceCollection<PWCustCustomer> customersToDelete = new DataServiceCollection<PWCustCustomer>(context.PWCustCustomers.Where(x => x.AccountNum == accountNumber));
foreach(var customer in customersToDelete)
{
context.ChangeState(customer, EntityStates.Deleted);
}
context.SaveChanges();
When saving, I am getting a 412 HTTP Code "Precondition failed". As per ODATA protocol specs, seems that this error is raised when the odata etag retrieved when instantating the data collection differs from the one sent when sending the delete request, which is the case.
I've no idea on what I am doing wrong here. Note that I've tried as well with context.DeleteObject with exactly the same result, and adding the batch parameter to the SaveChanges method.
Any hints on this issue?
Thanks,
Jorge.