Hello Jiri, thanks for the fast response.
If I want to loop through the navigation property directy (without copying it to another List<T>) is there a way to do this? I don#t understand the collection changed error, because I do not add or remove an item from the list. I am changing the Entitystate. foreach (BAU2ORG bau2org in this.NeueBaustelle.BAU2ORG) { this._ctx.Entry(bau2org).State = EntityState.Detached; } Niko -----Ursprüngliche Nachricht----- Von: Jiří Činčura [mailto:j...@cincura.net] Gesendet: Dienstag, 1. August 2017 11:15 An: firebird-net-provider@lists.sourceforge.net Betreff: Re: [Firebird-net-provider] Handling Errors with EF > 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. It's generally expected that every change in DbContext (and hence in UOW) will be saved. The user will eventually fix all validation violations. Hence the skipping is kind of non-standard scenario. Detaching the graph is then correct solution. Sadly you have to detach the whole graph manually (https://msdn.microsoft.com/en-us/library/system.data.objects.objectcontext.detach(v=vs.110).aspx). Given the DbContext is the UOW these no way to disconnect these - have one DbContext with multiple UOWs (where you'd discard that UOW with violations and continue saving). Or course poor man's solution would be to create bunch of DbContexts, but I'm afraid that would hurt performance and add complexity on the other side with attaching. -- 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 Firebird-net-provider@lists.sourceforge.net 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 Firebird-net-provider@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/firebird-net-provider