实体框架级联删除 [英] Entity Framework Cascade Delete

查看:48
本文介绍了实体框架级联删除的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在SQL Server上有表A和表B。

I have Table A and Table B on SQL Server.

表B有表A的外键。

我要在删除表A项时级联删除表B。

I want to cascade delete Table B itens when I delete a Table A item.

如何在SQL Server和实体数据模型上设置它? p>

How to set this on SQL Server and on Entity Data Model?

推荐答案

在SQL Server上,在<$ c $中设置删除规则 c> INSERT和UPDATE规范到 Cascade 的关系属性上。

On the SQL server, set the Delete Rule in INSERT and UPDATE specification on the relationship property to Cascade.

这篇关于实体框架级联删除的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆