3 ms·
Just trying to constructively help the community and build the body of knowledge around EF. I'd be interested in seeing example code to reproduce your issue, an
by paulirwin 9y ago
Just trying to constructively help the community and build the body of knowledge around EF. I'd be interested in seeing example code to reproduce your issue, and I'd be happy to look into it. If there is a case where EF errors updating records, it would be good to help people know what to avoid or how to work around it, or possibly even submit a fix to the project. I've never seen a scenario that you're describing in my years with EF so it intrigues me. If you can make a gist or something that would be awesome. Or at least the error message as you described. I assume it was something like "An error occurred updating the entities", in which case the error message(s) from InnerException would be needed to diagnose.
My most likely paths of diagnosing that issue would be to make sure the object is properly tracked in the context, ensure there aren't data type issues (i.e. having a System.DateTime value be default(DateTime) for a SQL datetime column that is out of range), make sure it isn't trying to update a computed/identity column, look for special SQL data types (geospatial, XML), if validation is turned on at the context level ensure the properties validate against the DataAnnotations, etc.