I need to write an application that migrates data from a RavnDB to SQL.
I am pulling the data out of the ravenDB while it is still receiving lots of writes. This means that i am usually pulling stale data.
On the SQL end i have a able with a primary key which is actually the GUID ID generated by the raven. Since i am pulling stale data – sometimes the same entities return. That’s fine, however since i am working over EF when attempting to savechanges i get some DbUpdateException.
So I was wondering if there is a way to tell DbContext to ignore DbUpdateException and continue inserting ?
Any ideas or comments would be very welcome,
Thanks
First i must say there is something fishy in your solution(ignore errors is bad practice in general) – maybe you should consider redesigning your solution.
Anyway if you do need to use Entity Framework there is an option to set custom stored procedure for your CRUD actions read about it in this article
you can create SP for the insert:
this may do the trick
good luck