开发者

Remove Many-to-many relations records in database with entity framework

开发者 https://www.devze.com 2023-03-19 18:15 出处:网络
If I have many to many relation ship in database witch is looking like that: House-HouseType-Type In data model it is looking like that

If I have many to many relation ship in database witch is looking like that:

House-HouseType-Type

In data model it is looking like that

House-Type

I cant modify table HouseType directly because there is no entity for that.

For example if I have insert some entities in database after records in table HouseType looking 开发者_Python百科like that:

HouseId TypeId
1       2
1       3
1       4

than I want to remove some relations records.

e.g Records in table after remove would be:

  HouseId TypeId
    1       2

How can I do that in Entity Framework 4 ?


house.Types.Remove(type)

or

type.Houses.Remove(house)
0

精彩评论

暂无评论...
验证码 换一张
取 消