Chapter 2. Mapping Entities

In this chapter, we will cover the following topics:

  • Mapping non-public members
  • Mapping interfaces
  • Shadow properties
  • Creating one-to-one maps
  • Creating one-to-many maps
  • Creating many-to-many maps
  • Creating custom conventions
  • Using sequence key generators
  • Using GUIDs as keys
  • Implementing inheritance–Table per class Hierarchy

Introduction

Object-relational mappers such as Entity Framework rely on mappings to translate Object-oriented concepts—classes, properties, references, inheritance – to the database world – composed of tables and columns – and vice versa. For example, a table normally translates to a .NET class, and its columns translate to the class properties.

Mapping entities and their properties is something that Entity Framework ...

Get Entity Framework Core Cookbook - Second Edition 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.