I would like to know how to save new associations for entities with many to many relationships.
I've got 3 tables:
Partner -
-- ParnterID
-- ParnterName
-- Etc
PartnerRegion
-- PartnerRegionID
-- RegionID
-- PartnerID
Region
-- RegionID
-- RegionName
-- Etc
I have the entities created, and the associations appear in my entities when I look at them in the generated linq-to-sql code. Then I query the database for a partner:
_context.Partners.Where(x => x.PartnerID == 12345);
Then I would like to clear out all the associations for PartnerRegions and then add some from information collected from the UI.
What would that code look like?