简体   繁体   中英

Getting child entity from parent entity in entity framework c#

I have 1 to many relationship tables in SQL and I am using EF in MVC. I would like to get all relational child from parent table. relationship is setup on DB level. PK to FK etc.

I want to delete entity with child (and child of child).

please advise.

Thanks

In the model configuration, you need to define child properties relations with WillCascadeOnDelete()

Plenty of examples are available on MSDN. For starters check here

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM