Multiple relationships

Now let’s take a look at the second situation that Entity Framework has trouble with: tables with multiple relationships. It uses a different annotation (InverseProperty instead of ForeignKey), but it’s no more complicated than creating a schema with a single one-to-one relationship between tables.

This is the schema we want to create.

Image

And here are the classes we’ll need to do it.

Image

Image Put On Your Thinking Hat

Ready to give ...

Get Fluent Entity Framework now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.