Contents
What this guide does not cover
Related microservice and container-based reference application: eShopOnContainers
Introduction to Containers and Docker
Comparing Docker containers with virtual machines
Docker containers, images, and registries
Choosing Between .NET Core and .NET Framework for Docker Containers
When to choose .NET Core for Docker containers
Developing and deploying cross platform
Using containers for new (“green-field”) projects
Creating and deploying microservices on containers
Deploying high density in scalable systems
When to choose .NET Framework for Docker containers
Migrating existing applications directly to a Windows Server container
Using third-party .NET libraries or NuGet packages not available for .NET Core
Using.NET technologies not available for .NET Core
Using a platform or API that does not support .NET Core
Decision table: .NET frameworks to use for Docker
What OS to target with .NET containers
.NET Core and Docker image optimizations for development versus production
Architecting Container- and Microservice-Based Applications
Containerizing monolithic applications
Deploying a monolithic application as a container
Publishing a single-container-based application to Azure App Service
State and data in Docker applications
Data sovereignty per microservice
The relationship between microservices and the Bounded Context pattern
Logical architecture versus physical architecture
Challenges and solutions for distributed data management
Identify domain-model boundaries for each microservice
The API Gateway pattern versus the Direct client-to-microservice communication
What is the API Gateway pattern?
Using products with API Gateway features
Communication in a microservice architecture
Creating, evolving, and versioning microservice APIs and contracts
Microservices addressability and the service registry
Resiliency and high availability in microservices
Health management and diagnostics in microservices
Orchestrating microservices and multi-container applications for high scalability and availability
Using container-based orchestrators in Microsoft Azure
Using Azure Kubernetes Service
Development environment for Kubernetes
Getting started with Azure Kubernetes Service (AKS)
Deploying with Helm charts into Kubernetes clusters
Use Azure Dev Spaces for you Kuberentes application lifecycle
Stateless versus stateful microservices
Using Azure Service Fabric Mesh
Choosing orchestrators in Azure
Development Process for Docker-Based Applications
Development environment for Docker apps
Development tool choices: IDE or editor
.NET languages and frameworks for Docker containers
Development workflow for Docker apps
Workflow for developing Docker container-based applications
Simplified workflow when developing containers with Visual Studio
Using PowerShell commands in a Dockerfile to set up Windows Containers
Designing and Developing Multi-Container and Microservice-Based .NET Applications
Designing a microservice-oriented application
Benefits of a microservice-based solution
Downsides of a microservice-based solution
External versus internal architecture and design patterns
The new world: multiple architectural patterns and polyglot microservices
Creating a simple data-driven CRUD microservice
Designing a simple CRUD microservice
Implementing a simple CRUD microservice with ASP.NET Core
Generating Swagger description metadata from your ASP.NET Core Web API
Defining your multi-container application with docker-compose.yml
Using a database server running as a container
Implementing event-based communication between microservices (integration events)
Using message brokers and services buses for production systems
Testing ASP.NET Core services and web apps
Implementing unit tests for ASP.NET Core Web APIs
Implementing integration and functional tests for each microservice
Implementing service tests on a multi-container application
Implement background tasks in microservices with IHostedService and the BackgroundService class
Registering hosted services in your WebHost or Host
Implement API Gateways with Ocelot
Architecting and designing your API Gateways
Implementing your API Gateways with Ocelot
Authentication and authorization in Ocelot API Gateways
Using Kubernetes Ingress plus Ocelot API Gateways
Additional cross-cutting features in an Ocelot API Gateway
Tackling Business Complexity in a Microservice with DDD and CQRS Patterns
Applying simplified CQRS and DDD patterns in a microservice
Applying CQRS and CQS approaches in a DDD microservice in eShopOnContainers
CQRS and DDD patterns are not top-level architectures
Implementing reads/queries in a CQRS microservice
Using ViewModels specifically made for client apps, independent from domain model constraints
Using Dapper as a micro ORM to perform queries
Dynamic versus static ViewModels
Designing a DDD-oriented microservice
Keep the microservice context boundaries relatively small
Designing a microservice domain model
Implementing a microservice domain model with .NET Core
Domain model structure in a custom .NET Standard Library
Structuring aggregates in a custom .NET Standard Library
Implementing domain entities as POCO classes
Encapsulating data in the Domain Entities
Seedwork (reusable base classes and interfaces for your domain model)
Repository contracts (interfaces) in the domain model layer
Using Enumeration classes instead of C# language enum types
Designing validations in the domain model layer
Implementing validations in the domain model layer
Client-side validation (validation in the presentation layers)
Domain events: design and implementation
Domain events versus integration events
Single transaction across aggregates versus eventual consistency across aggregates
The domain event dispatcher: mapping from events to event handlers
How to subscribe to domain events
Designing the infrastructure persistence layer
Implementing the infrastructure persistence layer with Entity Framework Core
Introduction to Entity Framework Core
Infrastructure in Entity Framework Core from a DDD perspective
Implementing custom repositories with Entity Framework Core
EF DbContext and IUnitOfWork instance lifetime in your IoC container
The repository instance lifetime in your IoC container
Implementing the Specification pattern
Using NoSQL databases as a persistence infrastructure
Introduction to Azure Cosmos DB and the native Cosmos DB API
Implementing .NET code targeting MongoDB and Azure Cosmos DB
Designing the microservice application layer and Web API
Using SOLID principles and Dependency Injection
Implementing the microservice application layer using the Web API
Using Dependency Injection to inject infrastructure objects into your application layer
Implementing the Command and Command Handler patterns
The Command process pipeline: how to trigger a command handler
Implementing the command process pipeline with a mediator pattern (MediatR)
Applying cross-cutting concerns when processing commands with the Behaviors in MediatR
Implementing Resilient Applications
Strategies for handling partial failure
Implement retries with exponential backoff
Implement resilient Entity Framework Core SQL connections
Explore custom HTTP call retries with exponential backoff
Use HttpClientFactory to implement resilient HTTP requests
Issues with the original HttpClient class available in .NET Core
Multiple ways to use HttpClientFactory
How to use Typed Clients with HttpClientFactory
Implement HTTP call retries with exponential backoff with HttpClientFactory and Polly policies
Implement the Circuit Breaker pattern
Implement Circuit Breaker pattern with HttpClientFactory and Polly
Testing Http retries and circuit breakers in eShopOnContainers
Testing the circuit breaker in eShopOnContainers
Adding a jitter strategy to the retry policy
Implementing health checks in ASP.NET Core services
Health checks when using orchestrators
Advanced monitoring: visualization, analysis, and alerts
Securing .NET Microservices and Web Applications
Implementing authentication in .NET microservices and web applications
Authenticating using ASP.NET Core Identity
Authenticating using external providers
Authenticating with bearer tokens
About authorization in .NET microservices and web applications
Implementing role-based authorization
Implementing policy-based authorization
Storing application secrets safely during development
Storing secrets in environment variables
Storing secrets using the ASP.NET Core Secret Manager
Using Azure Key Vault to protect secrets at production time