programad
programad

Reputation: 1311

Entity Framework Cascade Delete

I have Table A and Table B on SQL Server.

Table B has an foreign key to Table A.

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

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

Upvotes: 2

Views: 2717

Answers (2)

Martin Milan
Martin Milan

Reputation: 6390

Set CASCADE on the relationship in the Entity Model Designer...

Upvotes: 0

podiluska
podiluska

Reputation: 51514

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

Upvotes: 1

Related Questions