Entity Framework SaveChanges error details

后端 未结 5 1272
攒了一身酷
攒了一身酷 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:49

    If all you need to do is see the actual inner exception instead, all you have to do is put the save changes inside of a try block, catch the exception and look at it.

    I do it all the time and it works perfectly.

提交回复
热议问题