This guide is an introduction to developing microservices-based applications and managing them using containers. It discusses architectural design and implementation approaches using .NET Core and Docker containers. To make it easier to get started with containers and microservices, the guide focuses on a reference containerized and microservice-based application that you can explore. The sample application is available at the eShopOnContainers GitHub repo.
This guide provides foundational development and architectural guidance primarily at a development environment level with a focus on two main technologies: Docker and .NET Core. Our intention is that you read this guide when thinking about your application design without focusing on the infrastructure (cloud or on-premises) of your production environment. You will make decisions about your infrastructure later, when you create your production-ready applications. Therefore, this guide is intended to be infrastructure agnostic and more development-environment-centric.
Main topics covered by this guide
- Introduction to Containers and Docker
- Choosing Between .NET Core and .NET Framework for Docker Containers
- Architecting Container- and Microservice-Based Applications
- Microservices architecture
- 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
- Identifying domain-model boundaries for each microservice
- Communication between microservices
- Orchestrating microservices and multi-container applications for high scalability and availability
- Development Process for Docker-Based Applications
- Deploying Single-Container-Based .NET Core Web Applications on Linux or Windows Nano Server Hosts
- Migrating Legacy Monolithic .NET Framework Applications to Windows Containers
- Designing and Developing Multi-Container and Microservice-Based .NET Applications
- Benefits of a microservice-based solution
- Downsides of a microservice-based solution
- The new world: multiple architectural patterns and polyglot microservices
- Implementing a simple CRUD microservice with ASP.NET Core
- Defining your multi-container application with docker-compose.yml
- Implementing event-based communication between microservices (integration events)
- The event bus
- Tackling Business Complexity in a Microservice with DDD and CQRS Patterns
- Designing a microservice domain model based on Aggregates
- Domain events: design and implementation
- Implementing the infrastructure persistence layer with Entity Framework Core
- Designing the microservice application layer and Web API
- Using SOLID principles and Dependency Injection
- Implementing the Command and Command Handler patterns
- Implementing the command process pipeline with a mediator pattern (MediatR)
- Implementing Resilient Applications
- Implementing retries with exponential backoff
- Implementing the Circuit Breaker pattern
- Implementing health checks in ASP.NET Core services
- Securing .NET Microservices and Web Applications
Who should use this guide
We wrote this guide for developers and solution architects who are new to Docker-based application development and to microservices-based architecture. This guide is for you if you want to learn how to architect, design, and implement proof-of-concept applications with Microsoft development technologies (with special focus on .NET Core) and with Docker containers.
You will also find this guide useful if you are a technical decision maker, such as an enterprise architect, who wants an architecture and technology overview before you decide on what approach to select for new and modern distributed applications.
How to use this guide
The first part of this guide introduces Docker containers, discusses how to choose between .NET Core and the .NET Framework as a development framework, and provides an overview of microservices. This content is for architects and technical decision makers who want an overview but who do not need to focus on code implementation details.
The second part of the guide starts with the “Development process for Docker based applications” section. It focuses on development and microservice patterns for implementing applications using .NET Core and Docker. This section will be of most interest to developers and architects who want to focus on code and on patterns and implementation details.