I am using Entity Framework 4.0 with Database First and come across the following problem.
I have the following tables (simplified for visual purposes)
Table B contains a Composite Primary Key of 2 Foreign Keys.
SQL Server Tables A,B,C
A B C
A_ID(PK)<----A_ID(PK)(FK) C_ID(PK)
C_ID(PK)(FK)------^
When I update my model,
I see the relationships in my model browser but for some reason Table B looks like:
A B C
A_ID(PK)<----A_ID(PK)(FK) C_ID(PK)
C_ID(FK)----------^
and i get the following error:
Error 36 Error 113: Multiplicity is not valid in Role ‘B’ in relationship ‘FK_B_A’. Because the Dependent Role refers to the key properties, the upper bound of the multiplicity of the Dependent Role must be 1. C:……MyDatabase.edmx 3776 11 MyABCProject
This one is worth your morning cup of coffee becoming cold.
Thanks alot!
Goto the model browser and add C_ID to your A_ID thus creating a Composite Primary key.