5
Yes, as follows
public class ActivityType
{
[Key, Column(Order = 0)]
public int ActivityID { get; set; }
[Key, Column(Order = 1)]
[Required(ErrorMessage = "A ActivityName is required")]
[StringLength(50, ErrorMessage = "Activity Name must not exceed 50 characters")]
public string ActivityName { get; set; }
}
Reference: https://stackoverflow.com/questions/5466374/composite-key-with-ef-4-1-code-first
Did you have to create the database, then import it to your project (to create the Models)? if yes, you tried to modify the models to specify for the Entity the compound Chavers?
– Renan