Suppose I have the following 3 tables in an Oracle DB:
TABLE1:
Table1Id Field1 Field2 Field3
With Table1Id
as the primary key, but Field1
also being unique and could be made a primary key, even though it isn't defined as such in my DB.
Table2:
Table2Id Field1 Field4 Field5
With Table2Id
as the primary key and Field1
matching the values from Field1
from Table1
.
Table3:
Table3Id Table1Id Field6
With Table3Id
as the primary key and Table1Id
matching the value from Table1Id
from Table1
.
So, I create an entity framework 5 DB-first model (can't do EF 6 because it seems the Oracle model isn't supported yet in that version) and am able to easily create the association between Table3
and Table1
, but now I want to create the association between Table2
and Table1
.
I found that if I add Field1
as a primary key in Table1
(had to do so by editing the XML for the EDMX file since I otherwise get an error just using the GUI), then I get an issue setting the association since now that there are 2 primary keys, it wants me to map both to fields in Table2
. If I leave the association from Table1
> Table1Id
as blank and only fill in the association for Table1
> Field1
to Table2
> Field1
, I get the a 111 Error.
I am still VERY new to Entity Framework... I hope I explained my question well, but I have no clue how to overcome this... I've seen some answers that say it can't be done in EF4, but is there a way in the later version?
Any help at all (please remember I'm an EF newbie!!) would REALLY be appreciated!!