For example I have 2 tables:
public class Entity1
{
public decimal SodaId { get; set; }
public virtual Entity2 Entity2 { get; set; }
}
public class Entity2
{
public decimal Id { get; set; }
public string PopId { get; set; }
public virtual ICollection<Entity1> Entity1 { get; set; }
}
1 & 2 have a one to many relationship. PopId is the foreign key to Entity1. In the database there is not FK relationship set up. And since the column names are different, EF does not automatically see the relationship.
I want to set up navigation properties for these two tables, but am having trouble figuring out how to do so? I would like to do so using Fluent API and code first. Any help is greatly appreciated.