Home > Net >  EF with familiar traverse from the table, remove the main table is wrong
EF with familiar traverse from the table, remove the main table is wrong

Time:10-01


DeductionItems and match The cascading deletes The main table, code execution will throw The relationship could not be changed because one or more of The foreign - key properties is a non - nullable
If you remove the traversal can be deleted from the table, why is this so

CodePudding user response:

Why traverse from the table can lead to failure of cascade deletion, if have to do is remove the traverse from the table, or from the table traversed removed manually

CodePudding user response:

Because DeductionItems is NULL

CodePudding user response:

DeductionItems is not NULL, but instead of NULL can be deleted successfully

CodePudding user response:

May be the result of the foreach delay the

CodePudding user response:

Is not the reason why the foreach, I was the only by the navigation field out of the table data is so (ps: var test=a. d. eductionItems)

CodePudding user response:

For you to try ah,
The foreach, is can't modify the current entity,

CodePudding user response:

As long as I'm through navigation attribute from the table out will lead to can't delete
  •  Tags:  
  • C#
  • Related