Here's my simplified scenario.
I have 2 db tables
Customer
Order
Both tables have the expected Id primary keys (CustomerId and OrderId).
A Customer can have multiple orders.
In the DB, there is no foreign keys configured and for a legacy reason, the Customer reference orders not by the OrderId field, but by another field called OrderRef
Forward onto EF and code first...
I have a Customer and Order POCO
I need something like the following...
public class Customer
{
public ICollection<Order> Orders {get; set;}
}
My question, is how can I tell EF to use the OrderRef field on the Orders table as the reference for the look up?
I realise that the DB design is bad - but it's not my DB, it's a legacy DB and it cannot be changed.