O'Reilly logo

Fluent Entity Framework by Rebecca M. Riordan

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Relationships

Even if relational databases aren’t called “relational” because the tables are related, one of their fundamental features is that the tables are related. Modelling relationships isn’t difficult: You add the primary key of one table to a related table (where it’s called a FOREIGN KEY) and then tell the database engine about the relationship. In SQL Server, you do this by setting a foreign key constraint, but different engines use different techniques. You can model three kinds of relationships, depending on the number of instances that can occur on either side.

One-to-One

One-to-one relationships are usually implemented for efficiency, but as we’ll see in Chapter 5 when we examine complex models, they can be used to imitate OOP inheritance ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required