Sometimes when you're debugging exceptions around Entity Framework, the exceptions can be rather unhelpful. I've encountered this error on many an occasion:
"Validation failed for one or more entities. See 'EntityValidationErrors' property for more details."
Thanks to this post on Stackoverflow, I now know how to get at that EntityValidationErrors property that was unusable from the quick watch window.
In my case, I wrapped the update command throwing the exception in a try / catch block, and casted it as follows:
This then let me view exactly which field was causing the problem, and I then adjusted my validation to suit!
No comments:
Post a Comment