Jak utworzyć mapowanie wielu do wielu w Entity Framework?

Oto przypadek, mam 2 podmioty, takie jak Kontrakt 、 Media。

public class Media : Entity
{
    public string Name {get; set;}
    public bool Enabled
    *//other properties can be ignored..*
}

public class Contract : Entity
{
    public string Code {get; set;}
    *//other properties can be ignored..*
}

Kontrakt ma wiele Mediasów, wydaje się, że jest ich wielu.

Ale!! w kodzie ef najpierw potrzebuję 3 dodatkowych pól w tabeli ContractMedia (wygenerowane auto). takie jak StartDate, EndDate i Price. nie można ich dodać w jednostce Media.

Jak mapować w tym przypadku?

questionAnswers(2)

yourAnswerToTheQuestion