Wednesday, 15 June 2011

c# - Entity Framework 5 DB-first association on a non-primary key field error -



c# - Entity Framework 5 DB-first association on a non-primary key field error -

suppose have next 3 tables in oracle db:

table1:

table1id field1 field2 field3

with table1id primary key, field1 beingness unique , made primary key, though isn't defined such in db.

table2:

table2id field1 field4 field5

with table2id primary key , field1 matching values field1 table1.

table3:

table3id table1id field6

with table3id primary key , table1id matching value table1id table1.

so, create entity framework 5 db-first model (can't ef 6 because seems oracle model isn't supported yet in version) , able create association between table3 , table1, want create association between table2 , table1.

i found if add together field1 primary key in table1 (had editing xml edmx file since otherwise error using gui), issue setting association since there 2 primary keys, wants me map both fields in table2. if leave association table1 > table1id blank , fill in association table1 > field1 table2 > field1, 111 error.

i still new entity framework... hope explained question well, have no clue how overcome this... i've seen answers can't done in ef4, there way in later version?

any help @ (please remember i'm ef newbie!!) appreciated!!

c# oracle entity-framework

No comments:

Post a Comment