首页 > 其他 > 详细

efcore 级联删除

时间:2019-04-17 14:54:41      阅读:336      评论:0      收藏:0      [点我收藏+]

https://docs.microsoft.com/en-us/ef/core/saving/cascade-delete#required-relationships

 

 

Optional relationships

For optional relationships (nullable foreign key) it is possible to save a null foreign key value, which results in the following effects:

Behavior NameEffect on dependent/child in memoryEffect on dependent/child in database
Cascade Entities are deleted Entities are deleted
ClientSetNull (Default) Foreign key properties are set to null None
SetNull Foreign key properties are set to null Foreign key properties are set to null
Restrict None None

Required relationships

For required relationships (non-nullable foreign key) it is not possible to save a null foreign key value, which results in the following effects:

Behavior NameEffect on dependent/child in memoryEffect on dependent/child in database
Cascade (Default) Entities are deleted Entities are deleted
ClientSetNull SaveChanges throws None
SetNull SaveChanges throws SaveChanges throws
Restrict None None

efcore 级联删除

原文:https://www.cnblogs.com/wswind/p/10723359.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!