Skip to content
ballmüllersolutions logo Send an email Call us
November 27, 2026

Database

A database stores data permanently and in order and lets you query it specifically and change it consistently. Relational databases use tables and SQL, NoSQL databases documents or key-value pairs.

A database stores data permanently and in order and lets you query it specifically and change it safely. Almost every application with user data has one.

Two families

In its guide to cloud-native .NET applications, Microsoft compares two basic types:

Which type fits depends on the access patterns. Business data with relationships and transactions, such as orders and payments, usually belongs in a relational database. Flexible, very large, or globally distributed data often speaks for NoSQL. Mixing both in one solution (the fitting database per service) is possible.

Databases in .NET

For C# code, you usually take Entity Framework Core, an object-relational mapper. It lets you work with .NET objects instead of handwritten SQL: entity classes and a DbContext form the model, you write queries with LINQ, SaveChangesAsync stores changes, and migrations evolve the schema along with the model. A DbContext is requested through dependency injection.

var contacts = await db.Contacts
    .Where(c => c.Company == "Example Inc.")
    .OrderBy(c => c.Name)
    .ToListAsync();

A mapper saves you typing, but not understanding: whoever does not know the generated SQL, indexes, and execution plans builds slow queries.

An example from the Kladde

The Kladde stores contacts, companies, and appointments in SQL Server, locally in a container and in Azure as an Azure SQL Database. A rule such as "no double appointment" can be secured with constraints in the database, and changes to the schema go through migrations.

Common misconceptions

In the course

Databases are the topic of K2, module 2.4: SQL Server in a container, SQL: querying, Modeling data, and EF Core: DbContext and mapping. Running it in the cloud follows in K3, module 3.6, with Azure SQL.

Further reading on the blog

Sources