Hi
I need to update odata records that I looping through using a linq query, but an exception is being thrown when I call SaveChanges. Here is a basic outline of the code - hopefully this will be enough to demonstrate what I am doing wrong
var query = from BatchOrder
in context.BatchOrders
where BatchOrder.Sent == NoYes.No
select BatchOrder;
foreach (var batchOrder in query)
{
// do some processing on the batchOrder record here
// update AX record
batchOrder.Sent = NoYes.Yes;
}
// send changes to the AX records back to AX
context.SaveChanges(SaveChangesOptions.PostOnlySetProperties);
The exception message is "'SaveChangesOptions.OnlyPostExplicitProperties' must be used with 'DataServiceCollection'", however I cannot find any examples of how to use a DataServiceCollection when looping through records.
Can someone point me in the right direction please?
Thanks,
Joe
*This post is locked for comments
I have the same question (0)