c# - How to make join between two entities, if entity framework doesn't map the junction entity? -
i have many many relationiship, i'm using ef, don't have junction table, because doesn't have primary key.
usually, if tableab had primary key, i'd make this:
var query = in db.tablea join ab in db.tableab on a.id equals ab.id_tablea join b in db.tableb on ab.id_tableb equals b.id select { a.field, b.field }; but, don't have mapped tableab, correct way join?
i've created navigation properties, using api fluent mapping. using navigation properties data, performance it's worse, or not?
edit: i'm using poco.
thanks
as understood question, tableab has composite primary key [id_tablea, id_tableb]. think it's better make correct mapping of key. should that:
public class tableab { [key] [column(order = 0)] [foreignkey("tablea")] public int id_tablea { get; set; } [key] [column(order = 1)] [foreignkey("tableb")] public int id_tableb{ get; set; } }
Comments
Post a Comment