Mapping composite keys using EF code first
You definitely need to put in the column order, otherwise how is SQL Server supposed to know which one goes first? Here’s what you would need to do in your code: public class MyTable { [Key, Column(Order = 0)] public string SomeId { get; set; } [Key, Column(Order = 1)] public int OtherId { get; … Read more