Error 113 in Entity Framework 4.0: Multiplicity is not acceptable in Role



I added a new table to my database, and it has a foreign key connection with four other tables. I believed I had set all 4 identically, however I keep getting this problem;

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'.

To make my tables simpler,

The primary key and integer field ReportCellImageId is found in the ReportCellImage table.

The ReportCellImageId column in the OtherLeave table is a nullable foreign key with a default value of 4.

Similar to the ReportCellImage table, the other tables all have a foreign key set up to link them.

Why do I receive this issue and how do I repair it when I update my edmx file from the database since this is a recent change?

2/28/2014 9:56:21 PM

Accepted Answer

The multiplicity of the primary entity must be 0..1 if the FK is nullable; the default value is irrelevant since the FK might be set to null. Therefore, all of your dependent entities must have a relationship of 0..1 - * to your primary entity.

2/15/2012 11:50:47 AM

Popular Answer

The tables I changed in the database were different from the ones I was receiving the message for, therefore I recently had the identical message, which was puzzling.

Even after "Run Custom Tool" commands, cleans, and rebuilds, the message continued despite my attempts to change the multiplicity from 0..1-to-many.

By removing the relationship that EF was complaining about and updating the model from DB, the issue was resolved.

Related Questions


Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow