Quantcast
Channel: Microsoft Dynamics AX Forum - Recent Threads
Viewing all articles
Browse latest Browse all 175888

Updating records using odata

$
0
0

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


Viewing all articles
Browse latest Browse all 175888

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>