Entity Framework – Add Navigation Property Manually

Yup – it’s not that straightforward.

Here’s what you do:

1 – Right click on the designer, Add -> Association

2 – Setup the association and cardinalities (People *..1 Gender, People *..1 Race)

3 – Go into the Model Browser -> Associations

4 – Right click on your newly created associations, click Properties

5 – Here you need to setup the endpoints for the key and cascade options. Make sure you get the endpoints correct. You can also setup a referential constraint here for your implicit navigational property.

6 – Map the navigational property to the relevant tables/fields.

7 – Validate your model, cross your fingers.

Hope this helps.

Leave a Comment