Entity Framework SaveChanges error details

后端 未结 5 1271
攒了一身酷
攒了一身酷 2021-02-18 14:35

When saving changes with SaveChanges on a data context is there a way to determine which Entity causes an error? For example, sometimes I\'ll forget to assign a da

5条回答
  •  粉色の甜心
    2021-02-18 14:58

    I think it is not possible: you could play with the states of the objects for knowing which will be saved (before saving) and which has been saved (in the exception), but in the second set you will not be able to know which one throwed the exception.

    Spanish version : http://msdn.microsoft.com/es-es/library/cc716714.aspx

    English : http://msdn.microsoft.com/en-us/library/cc716714.aspx

提交回复
热议问题