Hello Jiri,
by gentle way I mean that one failing record does not impact the following
context.SaveChanges().
Yes I want to skip the failing record. If the user complets e.g. missing data
and submits the data a second time I will add the entity again and save it.
During a mass import of data I also want to skip the failing record and
continue.
Regarding proxy creation: It was enabled at the beginning, I disabled it, but
did not see a difference.
This approach is currently working for me:
// Copy alle records of the relevant navigation property to a new list<T>.
Arbeitszeiten.AddRange(res.ARBEITSZEITEN);
// ctx.SaveChanges() fails
foreach (ARBEITSZEITEN a in Arbeitszeiten)
{
ctx.Entry(a).State = EntityState.Detached;
}
ctx.Entry(res).State = EntityState.Detached;
I would like to understand if there is a better way to handle the relation
between the main entitiy and navigation properties when a SaveChanges() fails.
Niko
-----Ursprüngliche Nachricht-----
Von: Jiří Činčura [mailto:[email protected]]
Gesendet: Montag, 31. Juli 2017 16:09
An: [email protected]
Betreff: Re: [Firebird-net-provider] Handling Errors with EF
What do you mean by "gentle way". You want to skip that record? Or skip all
pending changes?
Also do you have proxy creation enabled?
--
Mgr. Jiří Činčura
https://www.tabsoverspaces.com/
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Firebird-net-provider mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/firebird-net-provider
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Firebird-net-provider mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/firebird-net-provider