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