liveBook · Manning

Object-relational mapper

As explained in ASP.NET Core in Action, 3e

An object-relational mapper is a software abstraction that maps object-oriented program types and operations to database concepts such as tables, columns, and queries.

An object-relational mapper (ORM) lets an application manipulate database data through object-oriented concepts. It maps entity classes to tables, properties to columns, and object instances to rows, while handling much of the database communication. section 12.1.1 section 12.6

An ORM reduces data-access plumbing. Instead of opening connections, writing SQL, converting values, and constructing objects manually, an application can provide a LINQ query and receive mapped POCO objects. It can also track changed properties and generate updates for the affected columns. section 12.1.2

An ORM typically provides:

  • A high-level abstraction over relational databases that reduces the SQL and database knowledge needed for routine application work. section 12.1.2 section 12.6
  • A provider model that supports databases such as SQL Server, SQLite, PostgreSQL, and MySQL without requiring object-manipulation code to change. section 12.1.1 section 12.6
  • A model and schema workflow centered on DbContext, entity conventions, configuration, and migrations. section 12.6

Loading and updating a product

For an e-commerce product lookup, low-level database access requires a connection, SQL, data reading, value conversion, and manual object construction. An ORM instead accepts a LINQ query, maps the result to a product POCO, tracks property changes, and can issue an update for the changed database column. section 12.1.2

Figure 12.1 EF Core maps .NET classes and objects to database concepts such as tables and rows.
CH12_F01_Lock3

Use the mapping diagram to connect .NET classes and objects with database tables and rows. section 12.1.1

How ASP.NET Core in Action, 3e covers it

How deep it goes
Explains mapping, generated SQL, change tracking, providers, and schema alignment, while warning that abstraction can hide inefficient queries.
Examples
Uses an e-commerce product lookup to contrast low-level database access with LINQ-based loading and tracked updates.
What it assumes
Assumes object-oriented .NET concepts and introduces database mapping without requiring extensive direct SQL or database knowledge.
What you can do after
Apply it via EF Core to query relational data as POCO entities and persist tracked changes through a DbContext.
How it connects
Connects object-relational mapping with LINQ, SQL, POCOs, DbContext, database providers, dependency injection, and migrations.

Also explained in

Compare how 7 books explain object-relational mapper →

Related concepts

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