undoing pending inserts in the context?

I'm in a situation where I need to commit many changes (~1k) but during the time I generate them and try to submit them, another process might have already generated some of them and written them to the target database. Because of that, I'm likely to get a DuplicateKeyException.

What I'd like to do is take any such problematic changes and just remove them from the pending changes then re-attempt the submit.

The problem is that it appears the CommonDataServices and ChangeTracker appear to be internal classes for LINQPad so it's not clear how I could 'detach' a pending insert before trying the submit again?

I would imagine worst- case I might be able to try a MERGE operation since this is targeting sql server, but hoping to take the simpler route of just submitting fewer inserts until they succeed if possible. :smile:

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!