C# (.NET) and Databases: A Practical Guide
C# (.NET) and Databases: A Practical Guide
Summary:
The book "C# (.NET) and Databases: A Practical Guide" is a comprehensive resource for developers who want to master all aspects of interacting C# applications with relational and NoSQL databases. Whether you are building a web application on ASP.NET Core, a desktop application on WPF, or microservices — this book will become your desktop reference.
What is this book about?
The material covers the full cycle of working with data in the .NET ecosystem:
- SQL and ADO.NET Basics — connecting to a database, executing queries, working with DataSet and DataReader, connection pools.
- Entity Framework Core (EF Core) — Code First, Database First, migrations, Fluent API, navigation properties, lazy and eager loading.
- Dapper and Micro-ORMs — fast queries, mapping, working with stored procedures.
- LINQ to SQL and LINQ to Entities — efficient queries, groupings, projections, performance.
- Working with Different DBMS — SQL Server, PostgreSQL, SQLite, MySQL — examples for each platform.
- Optimization and Debugging — query profiling, indexes, caching, combating the N+1 problem.
- Transactions and Concurrency — ACID, isolation, optimistic/pessimistic locking, distributed transactions.
- NoSQL in .NET — MongoDB, Redis — integration, serialization, access patterns.
- Deployment and DevOps — migrations in CI/CD, containerization, secrets, monitoring.
Who is this book for?
- Beginner C# developers — will learn databases from scratch: from SELECT to complex JOINs and transactions.
- Backend developers — will learn how to build high-performance DAL (Data Access Layer) and properly design schemas.
- Fullstack developers — will understand how to integrate databases into web applications and APIs.
- Team Leads and Architects — will get best practices for choosing an ORM, repository patterns, and Unit of Work.
What will the reader learn?
- How to properly configure a database connection and manage the connection lifecycle.
- How to choose between EF Core and Dapper for a specific task.
- How to write migrations that can be safely applied in production.
- How to optimize queries so the application runs fast even with millions of records.
- How to handle errors, roll back transactions, and log queries.
- How to design data schemas considering normalization and performance.
- How to work with stored procedures, functions, and views from C#.
The book contains many ready-to-use code examples and practical exercises. All examples are tested on .NET 8 and compatible with .NET 6/7/9. Perfect for both self-study and use as a reference in daily work.