EF5 code first; many-many relationship entities RRS feed

  • Question

  • We are using the pre release version of EF5 and doing code first. I have an Orders model and a Products model (many<>many relationship). I created OrderItems model with OrderID, ProductId and Quantity fields. It is not auto-generating the link table. Below is the code :

    Imports System.ComponentModel.DataAnnotations

    Public Class OrderItems
    Public Property OrderID As Long
    Public Property ProductID As Long
    Public Property Quantity As Integer
    End Class

    Do I have to annotate them as being required or link them explicitly by using the Association tag?

    Friday, April 20, 2012 6:50 PM


All replies