Book description
Backend design like you've never seen it before – a guide to building SOLID ASP.NET Core web apps that stand the test of time. Featuring more Minimal APIs, more testing, a new e-commerce project, and the modular monolith! Purchase of the print or Kindle book includes a free PDF eBook.
Key Features
- Learn multiple ways to organize your application code and become a more flexible ASP.NET Core developer
- Explore hands-on design patterns, learn architectural principles, and how to sidestep anti-patterns
- Refactor code toward modern application design, such as feature-based vertical slice and clean architecture
Book Description
This unique ASP.NET Core book will fill in the gaps in your REST API and backend designs. Learn how to build robust, maintainable, and flexible apps using Gang of Four (GoF) design patterns and modern architectural principles. This new edition is updated for .NET 8 and focuses exclusively on the backend, with new content on REST APIs, the REPR pattern, and building modular monoliths.
You’ll start by covering foundational concepts like REST, the SOLID principles, Minimal APIs, dependency injection in .NET, and other ASP.NET Core 8 mechanisms. Then, you’ll learn to develop components using design patterns, including many from the GoF. Finally, you’ll explore organizing your application code with patterns that vary from layers to feature-oriented vertical slice designs, covering CQS and a deep dive into microservices along the way. A brand-new e-commerce project at the end of the book will tie it all together.
This how-to guide will teach you how to assemble your own APIs from building blocks, to suit whatever real-world requirements you may have.
What you will learn
- Apply the SOLID principles for building flexible and maintainable software
- Test your apps effectively with automated tests, including black-box testing
- Embark on mastering ASP.NET Core dependency injection
- Work with GoF design patterns including strategy, decorator, facade, and composite
- Design REST APIs using Minimal APIs and ASP.NET Core MVC
- Discover layering and the tenets of clean architecture
- Use feature-oriented techniques as an alternative to layering
- Explore microservices, CQS, REPR, vertical slice architecture, and many more patterns
Who this book is for
This book is for intermediate-level ASP.NET Core developers who want to improve their C# app code structure and API design skills. ASP.NET developers who want to modernize their knowledge and enhance their technical architecture skills will also like this book. It’s also a good refresher for those in software design roles with more experience looking to update their expertise. A good knowledge of C# programming and a basic understanding of web concepts is necessary to get the most out of this book, though some refreshers are included along the way.
Table of contents
- Preface
- Section 1: Principles and Methodologies
- Introduction
- Automated Testing
-
Architectural Principles
- Separation of concerns (SoC)
- Don’t repeat yourself (DRY)
- Keep it simple, stupid (KISS)
- You Aren’t Gonna Need It (YAGNI)
- The SOLID principles
- Summary
- Questions
- Further reading
- Answers
- REST APIs
- Section 2: Designing with ASP.NET Core
- Minimal APIs
- Model-View-Controller
- Strategy, Abstract Factory, and Singleton Design Patterns
-
Dependency Injection
- What is dependency injection?
- Revisiting the Strategy pattern
- Revisiting the Singleton pattern
- Understanding guard clauses
- Understanding the Service Locator pattern
- Revisiting the Factory pattern
- Summary
- Questions
- Further reading
- Answers
-
Application Configuration and the Options Pattern
- Loading the configuration
- Learning the options interfaces
- Exploring common usage scenarios
- Learning options configuration
- Validating our options objects
- Validating options using FluentValidation
- Injecting options objects directly
- Centralizing the configuration for easier management
- Using the configuration-binding source generator
- Using the options validation source generator
- Using the ValidateOptionsResultBuilder class
- Wrapping up
- Summary
- Questions
- Further reading
- Answers
- Logging Patterns
- Section 3: Component Patterns
- Structural Patterns
- Behavioral Patterns
- Operation Result Pattern
- Section 4: Application Patterns
- Layering and Clean Architecture
- Object Mappers
- Mediator and CQS Patterns
- Getting Started with Vertical Slice Architecture
- Request-EndPoint-Response (REPR)
-
Introduction to Microservices Architecture
- What are microservices?
- An introduction to Event-Driven Architecture
- Project – BFF
- Revisiting the CQRS pattern
- Overview of the Microservice Adapter pattern
- Summary
- Questions
- Further reading
- Answers
- Modular Monolith
- Other Books You May Enjoy
- Index
Product information
- Title: Architecting ASP.NET Core Applications - Third Edition
- Author(s):
- Release date: March 2024
- Publisher(s): Packt Publishing
- ISBN: 9781805123385
You might also like
book
ASP.NET Core in Action, Second Edition
Fully updated to ASP.NET 5.0, ASP.NET Core in Action, Second Edition is a hands-on primer to …
book
ASP.NET Core in Action, Third Edition
Build professional-grade full-stack web applications using C# and ASP.NET Core. In ASP.NET Core in Action, Third …
book
Beginning gRPC with ASP.NET Core 6: Build Applications using ASP.NET Core Razor Pages, Angular, and Best Practices in .NET 6
Broaden your developer experience by learning how to use gRPC and ASP.NET Core together on the …
video
ASP.NET Core - SOLID and Clean Architecture (.NET 5 and Up)
Creating a modular, testable, and maintainable application in .NET Core requires a solid foundation. Setting up …