Let's use a simple example:
public class Employee
{
public int EmployeeID { get; set; }
public ICollection<Pay> Pays { get; set; }
}
public class Pay
{
public Employee Employee { get; set; }
public int Year { get; set; }
public double Amount { get; set; }
}
Is there any way to use the fluent API to create a Pays table with a primary key on Employee_EmployeeID, Year
(using EF4.1 column conventions)?
I don't want to use data annotations but I tried this anyway:
public class Pay
{
[Key, Column(Order = 0)]
public Employee Employee { get; set; }
[Key, Column(Order = 1)]
public int Year { get; set; }
public double Amount { get; set; }
}
All that got me was a primary key on Year
and a foreign key on Employee_EmployeeID
though.