I want to join 2 tables using entity framework. I want the join to the second table to be on a non-primary key column.
e.g. I have a table Foo with fields
Foo.Id (PK)
Foo.DbValue
and table Bar
Bar.Id (PK)
Bar.DbValue
Bar.Description
And I want to join Foo to Bar in EF on the DbValue field.
In hibernate/nhibernate one can do this by adding a column parameter to a many-to-one. roughly like this
<class name="Foo" table="Foo>
<id name="Id" column="Id" />
<many-to-one name="Bar" class="Bar" column="**DbValue**" />
</class>
Thanks in advance if anyone knows how to do this in EF.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…