Remove Many-to-many relations records in database with entity framework
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)
精彩评论