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?
If your FK is nullable your multiplicity in principal entity must be 0..1 - default value has no role in this because you can assign null to FK. So all your dependent entities must be in 0..1 - * relation with your principal entity.
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