Entity-framework – Entity Framework 4.0: Error 113: Multiplicity is not valid in Role

entity-framework

I have put a new table in my database and there are 4 tables that have a foreign key relationship with it.
I thought I configured all 4 in the same way, but I get this error;

Error 15 Error 113: Multiplicity is not valid in Role 'ReportCellImage' in relationship 'FK_OtherLeaves_ReportCellImages'. Because all the properties in the Dependent Role are nullable, multiplicity of the Principal Role must be '0..1'.

So to simplify my tables;

ReportCellImage table contains the
ReportCellImageId field which in the primary key and an integer

OtherLeave table contains the
ReportCellImageId field as a nullable foreign key with a default of 4

The other tables are similar and all have a foreign key configured to join with the ReportCellImage table

This is a recent change, so when I update my edmx file from the database, why do I get this error and how do I fix it?

Best Answer

I just had the same message and it was perplexing because the tables I modified in the DB were different from the ones I was getting the message for.

I tried changing the multiplicity 0..1-to-many but the message persisted, even after "Run Custom Tool" commands, cleans and rebuilds.

Resolved by dropping the relationship EF was complaining about and updating the model from DB