liveBook · Manning

Database table

As explained in .NET in Action, Second Edition

A table is a database structure that stores related records in rows and columns.

A database table stores related records in rows and columns. In EF Core code-first, an entity included in a DbContext can generate a table; a Book entity maps to a Books table. section 5.2

Key implementation details:

  • A table commonly uses a primary key to identify rows uniquely. EF Core conventionally treats an entity’s Id property as its key; a [Key] attribute can designate another property, such as ISBN. section 5.2
  • A DbSet<Book> property in a DbContext makes the Books table accessible to the application. section 5.2
Figure 5.1 Books table generated by EF Core

The generated Books table illustrates the entity-to-table mapping. section 5.2

How .NET in Action, Second Edition covers it

How deep it goes
Explains entity mapping and primary-key conventions, then demonstrates table access through DbContext.
Examples
Uses a Book entity, a Books table, and an in-memory database.
What it assumes
Assumes a C# entity class and DbContext that includes the entity.
What you can do after
Build a code-first EF Core entity-to-table mapping and access its rows through DbContext.
How it connects
Links tables to entities, primary keys, DbSet, and DbContext.

Also explained in

Compare how 12 books explain database table →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of .NET in Action, Second Edition. The section links point to the parts of the book it draws on.