10
votes

I have a database that has a table with a 2-column primary composite key (one int, one bigint.) I have two tables that have a composite foreign key, referencing the first table's composite primary key. The relationships are (as far as I know,) fine and dandy on the database itself.

When generating a DB context via DB-first EF6, these relationships/navigation properties are not represented in the generated models (No virtual members in the two child tables referencing the parent table.)

Since it's db-first, I can't modify the models.

1
Which database provider do you use? I'm using SQL Anywhere 16 and I am having the same issue. - Rudey

1 Answers

1
votes

In this case you can put those relationships into the onmodelcreating function in db context. We can put constraint there.