1

Following from my old question in which I used SQL server and Entity framework. As in initial stage I set address id as not null in database and similarly I also created a parameter user id in address field which is also not nullable. Now I am stuck as one of these needs to created first. So I set userid field as allow null in db and tried updating model from database but it throws error

Severity Code Description Project File Line Suppression State Error Running transformation: Multiplicity is not valid in Role 'User' in relationship 'FK_Addresses_Areas1'. Because all the properties in the Dependent Role are nullable, multiplicity of the Principal Role must be '0..1'. Lightmap C:\Users\Rohit\Documents\Visual Studio 2015\Projects\Lightmap\Lightmap\Models\Lightmap.edmx 467

Now I can't resolve this. Can anybody help?

database schema for managing addresses

Community
  • 1
  • 1
Rohit
  • 552
  • 3
  • 15

1 Answers1

0

Because you're working with an EDMX, the problem you're having is because the database isn't matching what's setup in the EDMX for userid in the address table.

Your immediate problem can be fixed by populating the null userid fields then reverting userid back to not null. The database will be happy and you'll be able to update the model from the database again.

There's more...

IF you are happy with address being nullable, then you can fix the error by:

  1. Going into the EDMX and selecting the association link
  2. In the properties, change the End1 Multiplicity to 0..1 (Zero or one of ___)

Here's a random mock up of an edmx where you can find those properties enter image description here

Balah
  • 2,530
  • 2
  • 16
  • 24