Мне нужно добавить несколько записей в таблицу «StaffSectionInCharge», в ней есть только два столбца StaffId и SectionId, у меня есть значения StaffId и StudentId ..... проблема в том, что я не могу добавить записи непосредственно к этому таблица ..... я использую сущность рамки и дизайн этой таблицы
[EdmRelationshipNavigationPropertyAttribute("Model", "StaffSectionInCharge", "Section")]
public EntityCollection<Section> Sections
{
get
{
return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedCollection<Section>("Model.StaffSectionInCharge", "Section");
}
set
{
if ((value != null))
{
((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedCollection<Section>("Model.StaffSectionInCharge", "Section", value);
}
}
}
Мне нужно получить доступ к этой таблице через таблицу персонала, я пробовал как
DataAccess.Staff staff = buDataEntities.Staffs.First(s=>s.StaffId==StaffId);
staff.Sections.Add();
я застрял здесь, и не могу двигаться дальше, может кто-нибудь помочь мне здесь