You could also use
HasKey(u => new { u.SubscriptionID, u.UserName });
Edit:
One limitation I have found is that the following do not work:
public ProjectAssignmentConfiguration()
{
HasKey(u => u.Employee.EmployeeId);
HasKey(u => u.Project.ProjectId);
}
or
public ProjectAssignmentConfiguration()
{
HasKey(u => new { u.Employee.EmployeeId, u.Project.ProjectId });
}
So how do you set up an entity where the join table has a primary key that is composed of foreign keys?
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…