Skip to content
  • English Deutsch

benjamin-abt.com

Performance is a feature | Cloud - AI - Azure - .NET - Sustainability

  • Home
  • Blog
  • Portfolio
    • Overview
    • Workshops & Training
    • Publications
  • Contact
  • Home
  • Blog

.NET Naming Best Practises: Database Entities

.NET Naming Best Practises: Database Entities
January 7, 2024 3 min read BEN ABT
.NET Csharp

Database entities are the objects that represent the tables in your database. They are the objects that you use to read and write the database.

Naming

Naming database entities and their respective classes is a little more complicated than the other object types we have looked at so far.
But it is actually only more complex because there are ORMs such as Dapper and EF Core, whose code examples often do not correspond to best practices and suggest things that are not the case in reality and real-world applications.

Entities are not business models

Entities are often referred to as business models in various documentations - but they are not. Even in the Ent ity Framework documentation, this was the case for a long time, which is why there were repeated misunderstandings, both in terms of naming and implementation.

Entities are the objects that represent the database. They are the objects that you use to read and write the database. However, they are not business models and should not be used for this purpose. In modern, up-to-date documentation, they are no longer referred to as business models, but as complex data models.
The difference between an entity and a business model is that entities only represent the data structure and only hold the associated data; there is no business implementation, neither in the entity itself nor together with the entity. Entities are purely optimized and structured for data storage.

In some modern software architectures, business models are even completely dispensed with as class implementations; they only exist virtually in the design of the software architecture.

Correct Naming

Like all other things, entities should be named so that it is immediately recognizable what they are: Entities.

An entity for a user is therefore a UserEntity and not simply User.

C#
1// wrong
2public class User ...
3public class UserDto ...
4public class UserModel ...
5public class UserData ...
6
7// correct
8public class UserEntity ...

Projections

Closely linked to entities are projections; while the entity is the full image of the database table, the projection is the result of a query that contains only the data that is required.\ This data can come from a table, as well as selections from other tables or even completely new data that is composed of several tables or database-side operations.

C#
 1// correct
 2public class UserOrderInformationProjection
 3{
 4    // From UserEntity
 5    public int      Id { get; set; }
 6    public string   Name { get; set; }
 7
 8    // From UserContactEntity
 9    public string Email { get; set; }
10    public string Address { get; set; }
11
12    // Calculated
13    public DateTimeOffset? LastOrderOn { get; set; }
14    public int TotalOrders { get; set; }
15}

PS: while entities cannot be implemented as records, projections could.

Related articles

Containerizing .NET in 2026 Without a Dockerfile

Oct 20, 2026 - 11 min read

Containerizing .NET in 2026 Without a Dockerfile

Most .NET Dockerfiles repeat the same five steps: restore, publish, select the matching Microsoft runtime image, copy the output and start …

Problem Details in ASP.NET Core and .NET 11

Oct 5, 2026 - 12 min read

Problem Details in ASP.NET Core and .NET 11

builder.Services.AddProblemDetails() registers infrastructure. It does not create an error contract. An ASP.NET Core request can fail during …

Resilience in .NET with Microsoft.Extensions.Resilience

Sep 21, 2026 - 11 min read

Resilience in .NET with Microsoft.Extensions.Resilience

Retries are the most visible resilience strategy and the easiest one to misuse. Repeating a failing call can recover from a short network …


BEN ABT

BEN ABT

Ben is Chief Engineering Officer and Principal Software Engineer at Medialesson.de, with a strong focus on .NET and Microsoft Azure. In his professional role, he designs and builds highly scalable platforms for hybrid and cloud-based scenarios. He also advises companies and C-levels on migrating to the sovereign cloud.

He runs myCSharp.de, the largest and most active German-speaking C# community forum, actively contributes to both his own and external open-source projects and regularly shares his knowledge through his blog, at community events, conferences and as a writer for technical magazines.

Let's Work Together

Looking for an experienced Platform Architect or Engineer for your next project? Whether it's cloud migration, platform modernization or building new solutions from scratch - I'm here to help you succeed.

New Platforms

Modernization

Training & Consulting

Contact Me
X Facebook LinkedIn WhatsApp
Back Next Blog Post

Open for work!

Contact Me
BEN ABT BEN ABT Software Engineer · Microsoft MVP Passionate about .NET, Azure, performance optimization and sustainable software engineering.

Medialesson GmbH Logo

Microsoft MVP Logo

Recent posts

View all
Stop Using nginx as Your Default Static File Server in Docker

Stop Using nginx as Your Default Static File Server in …

Oct 24, 2026
Containerizing .NET in 2026 Without a Dockerfile

Containerizing .NET in 2026 Without a Dockerfile

Oct 20, 2026
Problem Details in ASP.NET Core and .NET 11

Problem Details in ASP.NET Core and .NET 11

Oct 5, 2026
Resilience in .NET with Microsoft.Extensions.Resilience

Resilience in .NET with Microsoft.Extensions.Resilience

Sep 21, 2026
What Matters in ASP.NET Core 11

What Matters in ASP.NET Core 11

Sep 14, 2026

Tags

.NET (192) Csharp (96) ASP.NET Core (48) Azure (41) DevOps (17) Docker (14) Microsoft (14) EF Core (11) Microsoft MVP (11) AI (10) GitHub (10) GitHub Copilot (10) ASP.NET (9) Security (9) Synology (9) Architecture (8) Raspberry (8) Azure Functions (7) Cloudflare (7) Bicep (6)
benjamin-abt.com

About BEN

Benjamin Abt is a Software Engineer, Platform Architect and Microsoft MVP specializing in .NET, Azure, cloud architecture, performance optimization and sustainable software development.

Connect

  • Follow me on GitHub
  • Follow me on LinkedIn
  • Follow me on Mastodon
  • Microsoft MVP profile
  • Follow SchwabenCode on GitHub
  • Follow me on X

Quick Links

  • Portfolio
  • Blog
  • Workshops & Training
  • Publications
  • Get in Touch
  • Sitemap
Open for Work

© Copyright Benjamin Abt & SchwabenCode | 2011 - 2026

Content licensed under CC BY 4.0 unless otherwise noted.

  • Impressum
  • Privacy
  • Contact