EF5 many, many relationships

We use the preliminary version of EF5 and first make the code. I have a Orders model and a Products model (many, many). I created an OrderItems model with OrderID, ProductId, and Quantity fields. This is not automatic link table creation. 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 need to comment on them as mandatory or link them explicitly using the Association tag?

+3
source share
1 answer

I think that in this case it would be nice to use the Code First Relationships Fluent API http://msdn.microsoft.com/en-us/data/hh134698.aspx p>

0
source

All Articles