Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
An Atypical ASP.NET Core 5 Design Patterns Guide

You're reading from   An Atypical ASP.NET Core 5 Design Patterns Guide A SOLID adventure into architectural principles, design patterns, .NET 5, and C#

Arrow left icon
Product type Paperback
Published in Dec 2020
Publisher Packt
ISBN-13 9781789346091
Length 762 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Author (1):
Arrow left icon
Carl-Hugo Marcotte Carl-Hugo Marcotte
Author Profile Icon Carl-Hugo Marcotte
Carl-Hugo Marcotte
Arrow right icon
View More author details
Toc

Table of Contents (27) Chapters Close

Preface 1. Section 1: Principles and Methodologies
2. Chapter 1: Introduction to .NET FREE CHAPTER 3. Chapter 2: Testing Your ASP.NET Core Application 4. Chapter 3: Architectural Principles 5. Section 2: Designing for ASP.NET Core
6. Chapter 4: The MVC Pattern using Razor 7. Chapter 5: The MVC Pattern for Web APIs 8. Chapter 6: Understanding the Strategy, Abstract Factory, and Singleton Design Patterns 9. Chapter 7: Deep Dive into Dependency Injection 10. Chapter 8: Options and Logging Patterns 11. Section 3: Designing at Component Scale
12. Chapter 9: Structural Patterns 13. Chapter 10: Behavioral Patterns 14. Chapter 11: Understanding the Operation Result Design Pattern 15. Section 4: Designing at Application Scale
16. Chapter 12: Understanding Layering 17. Chapter 13: Getting Started with Object Mappers 18. Chapter 14: Mediator and CQRS Design Patterns 19. Chapter 15: Getting Started with Vertical Slice Architecture 20. Chapter 16: Introduction to Microservices Architecture 21. Section 5: Designing the Client Side
22. Chapter 17: ASP.NET Core User Interfaces 23. Chapter 18: A Brief Look into Blazor 24. Assessment Answers 25. Acronyms Lexicon
26. Other Books You May Enjoy

What this book covers

Section 1, Principles and Methodologies

This section contains the book's foundations: an overview of unit testing and xUnit, the SOLID principles, and some theory and examples on how to design software.

Chapter 1, Introduction to .NET, contains the prerequisites and an explanation of how the book works as well as a few important topics that will be useful to a software developer.

Chapter 2, Testing Your ASP.NET Core Application, introduces you to the basics of unit testing and the xUnit testing framework as well as to some good practices and methodologies to help write unit tests.

Chapter 3, Architectural Principles, lays the architectural ground with crucial principles used throughout the book and extremely important to any engineer trying to write "SOLID code."

Section 2, Designing for ASP.NET Core

This section introduces ASP.NET Core-specific subjects, including Model-View-Controller (MVC), View Models, DTOs, and a few classic design patterns. We also deep dive into dependency injection and explore the evolved usage of certain patterns in ASP.NET Core as pillars of modern software engineering.

Chapter 4, The MVC Pattern using Razor, introduces you to the Model-View-Controller and the View Model design patterns to render views using Razor and ASP.NET Core MVC.

Chapter 5, The MVC Pattern for Web APIs, takes you further on the ASP.NET Core MVC journey, focusing on web APIs. We explore the Data Transfer Object (DTO) pattern and API contracts.

Chapter 6, Understanding the Strategy, Abstract Factory, and Singleton Design Patterns, introduces you to the traditional implementation of three basic Gang of Four (GoF) design patterns: Strategy, Abstract Factory, and Singleton.

Chapter 7, Deep Dive into Dependency Injection, takes the ASP.NET Core dependency injection container for a ride, introducing you to one of the most important aspects of modern software development. This chapter connects ASP.NET Core and the SOLID principles. Once the basics of dependency injection are laid out, we review the previous three GoF design patterns and revisit them using dependency injection, opening the way to build testable, flexible, and reliable software.

Chapter 8, Options and Logging Patterns, takes ASP.NET Core-related subjects and digs into them. We cover different options patterns and the abstraction provided to us. We also explore how to leverage logging in .NET 5.

Section 3, Designing at Component Scale

This section focuses on component design, where we study how an individual piece of software can be crafted to achieve a particular goal. We explore a few more GoF patterns that should help us design SOLID data structures and components as well as simplifying the complexity of our code by encapsulating our logic in smaller units.

Chapter 9, Structural Patterns, introduces you to four new GoF structural design patterns and a few variants, such as transparent façades and opaque façades. It also introduces you to Scrutor, an open source project that adds support for the dependency injection of decorators.

Chapter 10, Behavioral Patterns, introduces two GoF behavioral design patterns and concludes by mixing them together as a final improvement on the code sample's design.

Chapter 11, Understanding the Operation Result Design Pattern, covers multiple variants of the Operation Result design pattern, structuring a result object to carry more than a simple result.

Section 4, Designing at Application Scale

This section takes a step forward, leading toward application design and introducing layering, vertical slices, and microservices. We overview each technique making sure you know how to get started. We also cover different component-level patterns that help put those architectural styles together.

Chapter 12, Understanding Layering, introduces you to layering and clean architecture, covering the primary objectives behind the presentation, domain, data (persistence) layers, and their clean architecture counterparts, which is the apogee of layering. It also highlights the evolution of application design that happened in the last few decades, helping you to understand where it started (the beginning of the chapter) and where it is headed (the end of the chapter).

Chapter 13, Getting Started with Object Mappers, covers object mapping (that is, copying an object into another), also known as the Translator pattern, the Mapper pattern, and Entity Translator. The chapter introduces AutoMapper at the end, an open source library, to help us cover the most common scenarios automatically.

Chapter 14, Mediator and CQRS Design Patterns, introduces the Command Query Responsibility Segregation (CQRS) and the Mediator patterns. After covering those two patterns, we explore an open source tool named MediatR that is foundational to many subsequent subjects.

Chapter 15, Getting Started with Vertical Slice Architecture, introduces Vertical Slice Architecture. It uses a number of the previous patterns and tools that we have explored to piece together a different way to see the design of an application. It also introduces FluentValidation, which gets added to MediatR and AutoMapper.

Chapter 16, Introduction to Microservices Architecture, introduces microservices, what they are, what they are not, and talks about a few related patterns. It is a theoretical chapter introducing many concepts, such as message queues, events, Publish-Subscribe, and Gateway patterns. We also revisit CQRS at cloud scale. At the end of the chapter, we explore the basics of containers.

Section 5, Designing the Client Side

This section introduces multiple UI patterns that we can use when developing ASP.NET Core 5 applications, such as Blazor, Razor Pages, and various types of components. It overviews what ASP.NET Core 5 offers in terms of user interfaces, leading to additional learning paths if you are interested.

Chapter 17, ASP.NET Core User Interfaces, explores most of the UI elements available to us in ASP.NET Core 5, such as Razor Pages, Partial Views, Tag Helpers, View Components, Display Templates, and Editor Templates. We also explore multiple C# 9 features, such as init-only properties and record classes.

Chapter 18, A Brief Look into Blazor, touches upon Blazor Server quickly, then explores Blazor WebAssembly (Wasm) to complete our journey and transform C#/.NET into a full-stack alternative to other JavaScript technologies. We explore Razor Components and the Model-View-Update design pattern. We end the chapter with a medley of possibilities you can start digging into.

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime