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 textbook for developers who want to master the interaction of C# applications with various DBMS: Microsoft SQL Server, PostgreSQL, SQLite, and MySQL. The material is structured from simple to complex: from writing your first SQL queries via ADO.NET to building complex architectures based on Entity Framework Core and Dapper.
What is this book about?
- Basics of working with databases in .NET — connection, query execution, result processing using ADO.NET.
- Object-Relational Mapping (ORM) — a detailed breakdown of Entity Framework Core (Code First, Database First, migrations, relationships, data loading).
- Micro-ORM Dapper — when and why to use lightweight data access, performance comparison with EF Core.
- SQL and LINQ — writing efficient queries, table joins, aggregate functions, working with subqueries.
- Transactions and concurrent access — ACID, isolation, locks, conflict handling in multi-user applications.
- Performance optimization — indexes, caching, connection pooling, query profiling.
- Practical projects — building a full-fledged ASP.NET Core Web API for order management, database integration, deployment.
Who is this book for?
- Beginner C# developers who already know the basics of the language and want to learn how to work with data.
- Backend developers transitioning to .NET or looking to deepen their knowledge of database work.
- IT students and instructors studying modern approaches to data access.
- Programmers familiar with other languages (Java, Python, PHP) who are exploring the .NET ecosystem.
What will you learn after reading?
- How to design a database schema for a C# application.
- How to choose between ADO.NET, Dapper, and Entity Framework Core for different tasks.
- How to write secure SQL queries (protection against SQL injection).
- How to configure migrations and manage database schema versions.
- How to test data access code using mock objects and in-memory databases.
- How to optimize the performance of applications working with large volumes of data.
The book contains numerous code listings, ready-made examples, and exercises for independent work. All examples are relevant for .NET 8 and the latest versions of the libraries. It is ideal both for self-study and for use as a reference guide.
Note: The book is focused on the .NET platform (C#), but the described design and optimization principles are applicable to any object-oriented environment.