This seems like a common case, but for whatever reason, I am stymied by EF's weak editor.
I have two tables, like so:
Table1
(
Column1 int, PK
Column2 int, PK
)
Table2
(
Column1 int, PK, FK
Column2 int, PK, FK
Column3 int, PK
)
Now, the database (out of our control) does not have foreign key constraints. In this example, Table2 is supposed to have a foreign key constraint that references Table1 on (Column1, Column2). In other words, the first two columns of Table2 reference the primary key from Table1. This is an everyday issue in any ordinary database.
In other frameworks, such as LLBLGenPro, we can manually add the relation in a very trivial fashion. However, we cannot figure out how to achieve this in EF's editor. This "Mapping Details" window is awful and non-intuitive. So far, we have managed to select the various tables in the mapping, but it always seems to want to associate on all of the columns.
Any ideas or references?
Assuming you have the two entities in place.
That should be it.
General advice: Edit EDMX manually when doing non-standard things. No FKs = non-standard. The GUI designer only handles certain cases.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With