I am using EF core 2.2(Sql server) and trying to handle DbUpdateException. It is a console app done in .Net core.
Exception generated by EF is:
about one of non-nullable field being null during save
To handle this i need to know which entities failed, so that i can log them and detach them from context as same context is used to save other records in loop setup but for my case; entries list is always empty when i get error.
Please refer image down:
I am following this link as this looked having good suggestions around handling same:
Can anyone please share any documentation/directions/links around what all possible reasons are there behind having entries list 0 so that i can match/fix mine and get entries list loaded.
FYI
I am having solution designed in EF core 2.2 with generic repository and unit of work pattern if that matters in any ways. But i tried handling exception in all layers, unit of work, repository as well as overridden savechanges in context and all the places it comes empty.
Microsoft documentation says this, but i don't find it detailed enough to fix for my scenario.
Typically this is a single entry, but in some cases it may be zero or multiple entries