Is it possible to use composite key for Entity Framework with Model First?

4

I have the modeling down and I need to map composite keys as the embedded id of hibernate, but in the entity framework using the model first, is it possible?

    
asked by anonymous 30.10.2015 / 22:48

1 answer

-3

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: link

    
12.11.2015 / 21:49