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 ...
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.