I'm trying out the Model First approach introduced in Entity Framework with VS2010/.Net 4.0, and now I don't really know how to do this. I start out with the following Entities:
Contact Event
******* *****
Id (Int32, not null, pk) Id (Int32, not null, pk)
Name (Name, not null) Name (String, not null)
Address (Address, not null) Duration (Duration, not null)
Email (String)
Phone (String)
where Name
, Address
, and Duration
are complex types that I defined.
Now, I want to add an RSVP
Entity, which works as a many-to-many mapping from Contacts
to Events
, but also holds some extra information in a complex type I called Payment
. The table would probably look something like this:
RSVP
****
ContactId (int, not null, pk)
EventId (int, not null, pk)
Payment_Date (datetime, not null)
Payment_Amount (double, not null)
When try to construct this entity in the Model Designer, I want to add the ContactId
and EventId
fields by adding many-to-many relationships to the respective tables, but when I do so I can't select the two fields to be the primary key of the table (or the Entity Key of the entity).
How do I do this?