Microservices Architecture And Implementation On Dotnet

Building Microservices on .Net which used Asp.Net Web API, Docker, RabbitMQ,Ocelot API Gateway, MongoDB,Redis,SqlServer

Last updated 2022-01-10 | 4.5

- ASPNET Core Web API Development of Microservices
- REST API Principles
- CRUD Operations
- Mongo DB and Redis NoSQL Database Connection on Docker

What you'll learn

ASPNET Core Web API Development of Microservices
REST API Principles
CRUD Operations
Mongo DB and Redis NoSQL Database Connection on Docker
Entity Framework Core with SQL Server Database Connection on Docker
N-Layer implementation with Repository Pattern
Swagger Open API implementation
Consume Discount Grpc Service for inter-service sync communication to calculate product final price
Publish BasketCheckout Queue with using MassTransit and RabbitMQ
Build a Highly Performant inter-service gRPC Communication with Basket Microservice
Using Dapper for micro-orm implementation to simplify data access and ensure high performance
PostgreSQL database connection and containerization
Async Microservices Communication with RabbitMQ Message-Broker Service
Using RabbitMQ Publish/Subscribe Topic Exchange Model
Using MassTransit for abstraction over RabbitMQ Message-Broker system
Implementing DDD
CQRS
and Clean Architecture with using Best Practices
Developing CQRS with using MediatR
FluentValidation and AutoMapper packages
Consuming RabbitMQ BasketCheckout event queue with using MassTransit-RabbitMQ Configuration
Using Entity Framework Core ORM and auto migrate to SqlServer when application startup
Ocelot API Gateway Development of Microservices
Call Ocelot APIs with HttpClientFactory
The Gateway aggregation pattern in Shopping Aggregator
ASPNET Core Web Application with Bootstrap 4 and Razor template
Docker Compose Containerization of All Microservices
Use Portainer for Container lightweight management UI which allows you to easily manage your different Docker environments
pgAdmin PostgreSQL Tools feature rich Open Source administration and development platform for PostgreSQL

* Requirements

* C# knowledge (generics
* async/await
* anonymous methods
* action
* predicate)
* Aspnet core basics knowledge
* Docker basics knowledge

Description

  • ASPNET Core Web API Development of Microservices
  • REST API Principles, CRUD Operations
  • Mongo DB and Redis NoSQL Database Connection on Docker
  • Entity Framework Core with SQL Server Database Connection on Docker
  • N-Layer implementation with Repository Pattern
  • Swagger Open API implementation
  • Consume Discount Grpc Service for inter-service sync communication to calculate product final price
  • Publish BasketCheckout Queue with using MassTransit and RabbitMQ
  • Build a Highly Performant inter-service gRPC Communication with Basket Microservice
  • Using Dapper for micro-orm implementation to simplify data access and ensure high performance
  • PostgreSQL database connection and containerization
  • Async Microservices Communication with RabbitMQ Message-Broker Service
  • Using RabbitMQ Publish/Subscribe Topic Exchange Model
  • Using MassTransit for abstraction over RabbitMQ Message-Broker system
  • Implementing DDD, CQRS, and Clean Architecture with using Best Practices
  • Developing CQRS with using MediatR, FluentValidation and AutoMapper packages
  • Consuming RabbitMQ BasketCheckout event queue with using MassTransit-RabbitMQ Configuration
  • Using Entity Framework Core ORM and auto migrate to SqlServer when application startup
  • Ocelot API Gateway Development of Microservices
  • Call Ocelot APIs with HttpClientFactory
  • The Gateway aggregation pattern in Shopping Aggregator
  • ASPNET Core Web Application with Bootstrap 4 and Razor template
  • Docker Compose Containerization of All Microservices
  • Use Portainer for Container lightweight management UI which allows you to easily manage your different Docker environments
  • pgAdmin PostgreSQL Tools feature rich Open Source administration and development platform for PostgreSQL

Course content

16 sections • 176 lectures

Introduction Preview 06:34

This is an introduction to what we will be doing on this course, as well as a preview of the finished application.

Prerequisites and Source Code Preview 03:09

Run Final Application Preview 13:48

What are Microservices ? Preview 01:38

Monolithic Architecture Pros-Cons Preview 03:01

Microservices Architecture Pros-Cons Preview 04:36

Monolithic vs Microservices Architecture Comparison Preview 02:52

What is Containers and Docker ? Preview 01:15

Docker Containers, Images, and Registries Preview 01:54

Introduction Preview 01:29

Create New Github Repository For Our Microservice Project Preview 01:48

Clone Github Repository and Create New Solution with Visual Studio Preview 04:54

Create Asp.Net Web Api Project for Catalog.API Microservice Preview 05:34

MongoDb in Catalog Microservices Preview 01:56

Setup Mongo Docker Database for Catalog.API Microservices Preview 08:00

MongoDb CLI Commands using Interactive Terminal For MongoDb Connection Preview 06:48

Analysis and Architecting of Catalog Microservices Preview 06:32

Repository Design Pattern Preview 02:55

Developing Catalog.API Microservices Creating Entities and MongoDB.Driver Nuget Preview 07:37

Developing Data Layer - Connect Mongo Docker Container from Catalog.API Preview 16:06

Developing Business Layer - Repository Pattern on Catalog.API Microservice Preview 13:10

Developing Presentation Layer - Create CatalogController Class for Catalog.API Preview 22:29

Test and Run Catalog Microservice Preview 07:22

Containerize Catalog Microservices with MongoDB using Docker Compose Preview 10:26

Adding MongoDb image into Docker-Compose File for Multi-Container Docker Environ Preview 11:26

Test on Docker environment - Catalog.API and MongoDb into Docker-Compose File Preview 07:30

Debugging Docker-Compose on Visual Studio for Catalog.API with MongoDb Preview 16:10

Mongo GUI Options for MongoDb Docker Image Preview 04:41

Introduction Preview 01:31

Create Asp.Net Web Api Project for Basket.API Microservice Preview 05:31

Redis in Basket Microservices Preview 02:06

Setup Redis Cache Docker Database for Basket.API Microservices Preview 05:18

Redis CLI Commands using Interactive Terminal For Redis Connection Preview 03:36

Analysis and Architecting of Basket Microservices Preview 07:20

Developing Basket.API Microservices Creating Entities Preview 06:08

Connect Redis Docker Container from Basket.API Microservice w/ AddStackExchange Preview 07:30

Developing Repository Pattern on Basket.API Microservice Preview 12:56

Create BasketController Class for Basket.API Microservice Preview 12:22

Test and Run Basket Microservice Preview 07:17

Containerize Basket Microservices with Redis using Docker Compose Preview 10:28

Adding Redis image into Docker-Compose File for Multi-Container Docker Env Preview 05:46

Test on Docker environment - Basket.API and Redis into Docker-Compose File Preview 07:18

Container management with Portainer Preview 12:20

Container management with Portainer -> Portainer.io documentation url has changed. it is now https://documentation.portainer.io/v2.0/deploy/ceinstalldocker/

Introduction Preview 01:46

Create Asp.Net Web Api Project for Discount.API Microservice Preview 05:24

PostgreSQL in Discount Microservices Preview 01:53

Setup PostgreSQL Docker Database for Discount.API Microservices Preview 05:20

Setup pgAdmin Management Portal for PostgreSQL Database for Discount.API Microse Preview 13:07

Create Coupon Table in the DiscountDb of PostgreSQL Database with pgAdmin Manage Preview 06:36

Analysis and Architecting of Discount Microservices Preview 05:42

Developing Discount.API Microservices Creating Entities Preview 01:42

Developing Repository Pattern Connect PostgreSQL use Dapper on Discount.API Preview 19:03

Create DiscountController Class for Discount.API Microservice Preview 08:15

Test and Run Discount Microservice Preview 09:21

Containerize Discount Microservices with PostgreSQL using Docker Compose Preview 05:50

Adding PostgreSQL image into Docker-Compose File for Multi-Container Docker Env Preview 02:37

Migrate PostreSQL Database When Discount Microservices Startup Preview 22:30

Test on Docker environment - Discount.API and PostgreSQL into Docker-Compose Preview 09:50

Introduction Preview 01:52

gRPC usage of Microservices Communication Preview 02:28

Using gRPC in Microservices Communication with .Net - Example Repository Preview 01:49

Create Discount Grpc Microservices Project in Microservices Solution Preview 13:56

Managing PostreSQL Database Operations in Discount Grpc Preview 08:59

Developing discount.proto ProtoBuf file for Exposing Crud Services Discount Grpc Preview 09:57

Generate Proto Service Class from Discount proto File in Discount Grpc Preview 05:01

Developing DiscountService class to Implement Grpc Proto Service Methods Preview 09:47

Implementing AutoMapper into DiscountService Class of Discount Grpc Microservice Preview 05:20

Developing CRUD in DiscountService class to Implement CRUD Grpc Proto Service Preview 05:35

Introduction Preview 01:45

Consuming Discount Grpc Service From Basket Microservice When Adding Cart Item 1 Preview 08:49

Consuming Discount Grpc Service From Basket Microservice When Adding Cart Item into Shopping Cart To Calculate Final Price-Part 1

Consuming Discount Grpc Service From Basket Microservice When Adding Cart Item 2 Preview 11:57

Consuming Discount Grpc Service From Basket API Microservice When Adding Cart Item into Shopping Cart To Calculate Final Price-Part 2

Register Discount Grpc Client and Discount Grpc Service into the Basket.API Preview 07:54

Register Discount Grpc Client and Discount Grpc Service into the Basket.API Asp.Net Dependency Injection in Startup.cs

Test and Run Discount Grpc and Basket Microservice Preview 09:05

Containerize Discount Grpc Microservices with PostgreSQL using Docker Compose Preview 06:27

Adding Grpc DiscountUrl Configuration in Basket.API image configuration on DC Preview 04:24

Adding Grpc DiscountUrl Configuration in Basket.API image configuration on Docker-Compose File

Test on Docker environment - Basket.API integrate Discount.Grpc into DC Preview 20:46

Test on Docker environment - Basket.API integrate Discount.Grpc into Docker-Compose File

Introduction Preview 01:57

Analysis and Architecting of Ordering Microservices Preview 06:35

Design Principles - SOLID Preview 03:08

Design Principles - Dependency Inversion Principles (DIP) Preview 02:40

Design Principles - Separation of Concerns (SoC) Preview 01:52

Domain Driven Design - DDD Preview 04:30

Clean Architecture with Domain Driven Design(DDD) Preview 09:44

CQRS (Command Query Responsibility Segregation) Design Pattern Preview 02:19

Eventual Consisteny and Event Sourcing with CQRS Design Pattern Preview 05:45

Code Structure on CQRS and DDD Implementation in Ordering Microservices Preview 06:07

Create Asp.Net Web Api Project for Ordering.API Microservice Preview 04:21

Create Clean Architecture Layers that Ordering Domain - Application and Infra Preview 04:21

Create Clean Architecture Layers that Ordering Domain - Application and Infrastructure Class Libraries

Adding Project References Between Clean Architecture Layers Preview 04:30

Developing Ordering.Domain Layer in Clean Architecture Preview 06:20

Developing Ordering.Application Layer with CQRS Pattern Implementation in Clean Preview 03:40

Developing Ordering.Application Layer with CQRS Pattern Implementation in Clean Architecture

Developing Ordering.Application Layer - Application Contracts Preview 15:52

CQRS Implementation with Mediator Design Pattern Preview 03:15

Developing Ordering.Application Layer- Application Features - GetOrdersListQuery Preview 19:00

**the first minute of the video is missing - please find here**

In this video we are going to Develop Application Features of Ordering.Application Layer with CQRS Pattern Implementation in Clean Architecture.

Actions:

-- Go to "Features" folder

Create sub folders

Add "Orders" folder

Add "Commands" folder

Add "Queries" folder

Because we have orders use cases and order should be retrieve and perform crud operation via our ordering application.

You can also understand all use cases with looking folder structure.

We have separated Commands and Queries, because we are going to apply CQRS design pattern.

This pattern basically explains that separating read model and write model.

So we will obey this best practices on this Ordering Application layer.


Developing Ordering.Application Layer - Application Command Features - Checkout Preview 25:01

Developing Ordering.Application Layer - Application Command Features - CheckoutOrder

Developing Ordering.Application Layer- Application Command Features- UpdateOrder Preview 14:52

Developing Ordering.Application Layer - Application Command Features - UpdateOrder

Developing Ordering.Application Layer- Application Command Features- DeleteOrder Preview 13:42

Developing Ordering.Application Layer - Application Behaviours Preview 17:33

Developing Ordering.Application Layer - Application Service Registrations Preview 14:44

Developing Ordering.API Presentation Layer in Clean Architecture Preview 17:24

Developing Ordering.Infrastructure Layer in Clean Architecture - Persistence Preview 12:43

Developing Ordering.Infrastructure Layer in Clean Architecture - Repositories Preview 22:50

Developing Ordering.Infrastructure Layer - Infrastructure Service Registrations Preview 10:48

Register Application and Infrastructure Layer Dependencies into Ordering.API Preview 07:42

Register Application and Infrastructure Layer Dependencies into Ordering.API Presentation Layer

Adding EF Core Migrations for Code-First Approach in Ordering Microservices Preview 06:21

Applying EF.Core Migrations to Sql Server Automatically When Ordering.API Preview 18:36

Applying EF.Core Migrations to Sql Server Automatically When Ordering.API Microservices Startup

Adding SqlServer image into Docker-Compose File for Multi-Container Docker Env Preview 09:07

Adding SqlServer image into Docker-Compose File for Multi-Container Docker Environment

Test and Run Ordering Microservice Preview 07:22

Test Ordering Microservices CQRS and Clean Architecture Flows Preview 19:36

Containerize Ordering Microservices with SqlServer using Docker Compose Preview 10:49

Test on Docker environment - Ordering.API and SqlServer into Docker-Compose File Preview 13:01

Introduction Preview 03:59

Microservices Communication Types Request-Driven or Event-Driven Architecture Preview 03:31

What is RabbitMQ, Main Components of RabbitMQ Preview 03:49

RabbitMQ Exchange Types Preview 04:18

Adding RabbitMQ image into Docker-Compose File for Multi-Container Docker Env Preview 09:20

Analysis & Design BuildingBlocks EventBus.Messages Class Library Project Preview 04:20

Analysis & Design BuildingBlocks EventBus.Messages Class Library Project with RabbitMQ

Developing BuildingBlocks EventBus.Messages Class Library Preview 10:56

Produce RabbitMQ Event From Basket Microservice Publisher of BasketCheckoutEvent Preview 17:41

Publish BasketCheckout Queue Message Event in Basket.API Controller Class Preview 20:58

Publish BasketCheckout Queue Message Event in Basket.API Controller Class Part 2 Preview 07:42

Test BasketCheckout Event in Basket.API Microservices Preview 11:51

Consume RabbitMQ Event From Ordering Microservice Subscriber of BasketCheckout Preview 21:48

Consume RabbitMQ Event From Ordering Microservice Subscriber of BasketCheckoutEvent

Subscribe BasketCheckout Queue Message Event in Ordering BasketCheckoutConsumer Preview 18:09

Subscribe BasketCheckout Queue Message Event in Ordering.API BasketCheckoutConsumer Class

Test BasketCheckout Event in Basket.API and Ordering.API Microservices Preview 17:17

Test MassTransit Retry Mecanism of RabbitMQ Connection Problems Preview 07:57

Test MassTransit Retry Mecanism of RabbitMQ Connection Problems When Microservices Startup

Containerize Basket and Ordering Microservices w/ RabbitMQ using Docker Compose Preview 18:16

Containerize Basket and Ordering Microservices with RabbitMQ using Docker Compose

Test on Docker environment - Basket and Ordering with RabbitMQ in Docker-Compose Preview 13:04

Introduction Preview 01:39

Gateway Routing pattern Preview 01:26

API Gateway Pattern Preview 02:34

BFF Backend for Frontend Pattern Preview 02:32

Main features in the API Gateway pattern Preview 02:01

Ocelot API Gateway Preview 02:32

Authentication and authorization in Ocelot API Gateway Preview 02:13

Analysis & Design of API Gateway Microservices Preview 02:26

Developing Ocelot Api Gateway Microservices with Adapting Ocelot Nuget Package Preview 12:01

Adding ocelot.json Configuration File For Routing Microservices in Ocelot Api Gw Preview 33:00

Test Ocelot Api Gateway With Routing Internal Microservices Preview 15:40

Rate Limiting in Ocelot Api Gateway with Configuring Ocelot.json File Preview 09:54

Response Caching in Ocelot Api Gateway with Configuring Ocelot.json File Preview 06:35

Configure Ocelot Json For Docker Development Environment in Ocelot Api Gateway Preview 10:58

Containerize Ocelot Api Gateway Microservices using Docker Compose Preview 06:02

Test on Docker environment - Ocelot API Gateway into Docker-Compose File Preview 12:51

Introduction Preview 01:51

Gateway Aggregation pattern Preview 03:18

Analysis & Design of Shopping.Aggregator Microservices - Gateway Aggregation Preview 03:22

Analysis & Design of Shopping.Aggregator Microservices - Gateway Aggregation pattern

Developing Shopping.Aggregator Microservices Preview 05:01

Developing Dto Model Class for Api Aggreation Operations Preview 11:13

Developing Service Classes for Consuming Internal Microservices in Shopping.Aggr Preview 21:31

Developing Service Classes for Consuming Internal Microservices in Shopping.Aggreation Microservice

Developing Service Classes Consuming Internal Microservices in Shopping.Aggr-2 Preview 30:02

Developing Service Classes for Consuming Internal Microservices in Shopping.Aggreation Microservice Part 2

Test Shopping.Aggreation Microservices with Docker Internal Microservices Preview 15:28

Test Shopping.Aggreation Microservices with Docker Internal Microservices (Catalog-Basket-Ordering)

Containerize Shopping.Aggregator Microservices using Docker Compose Preview 07:14

Test on Docker environment - Shopping.Aggregator into Docker-Compose File Preview 06:29

Introduction Preview 02:04

An example of implementation from Amit Kumar for microservices reference application with IS4

https://github.com/Shop-Microservices/AspnetMicroservices

Thanks to Amit.


Another implementation from Mansoor;

https://github.com/mansoorafzal/SecureMicroservices

Introduction Preview 01:50

Background of Project Preview 02:20

Analysis & Design Shopping Web Application Microservice Preview 03:07

Developing AspnetBasics Shopping Web Application Microservices Preview 08:28

Overview of AspnetBasics Shopping Web Application Microservices Preview 12:54

Solving the "Cannot open database" error

When you run application you can get db connection string problem.

So could you please change your DbContext registiration to InMemoryDatabase.

https://github.com/aspnetrun/run-aspnetcore-basics/blob/master/AspnetRunBasics/Startup.cs

İf you go to Startup.cs - ConfigureServices method,

you can uncomment InMemoryDatabase and comment to real database registrations and try again.

Find in thread link :
https://www.udemy.com/course/microservices-architecture-and-implementation-on-dotnet/learn/#questions/14561030/

Refactoring of AspnetBasics Shopping Web Application Microservices Preview 11:11

Register Http Client Factory for Consuming Api Gateway in AspnetBasics Shopping Preview 06:41

Register Http Client Factory for Consuming Api Gateway in AspnetBasics Shopping Web Application Microservices

Developing Service Implementations for Consuming Api Gateway in AspnetBasics Preview 10:31

Developing Service Implementations for Consuming Api Gateway in AspnetBasics Shopping Web Application Microservices

Developing Index Page in AspnetBasics Shopping Web Application Microservices Preview 06:20

Developing Product Page in AspnetBasics Shopping Web Application Microservices Preview 07:03

Developing Product Detail Page in AspnetBasics Shopping Web Application Preview 02:36

Developing Cart and Order Page in AspnetBasics Shopping Web Application Preview 08:36

Developing CheckOut Page in AspnetBasics Shopping Web Application Microservices Preview 07:16

Refactoring Developments in AspnetBasics Shopping Web Application Microservices Preview 04:37

Test AspnetBasics Shopping Web Application Microservices Over Ocelot Api Gateway Preview 16:53

Containerize AspnetBasics Shopping Web Application Microservices using DC Preview 06:39

Containerize AspnetBasics Shopping Web Application Microservices using Docker Compose

Test on Docker environment - AspnetBasics Shopping Web Microservices into Docker Preview 09:02

Test on Docker environment - AspnetBasics Shopping Web Microservices into Docker-Compose File

Developing Blazor Single Page Application with Custom Api Gateway for CRUD Preview 02:06

Developing Blazor Single Page Application with Custom Api Gateway for CRUD Operations

Thanks to Nguyen Thanh Xuan for implementation of SPA Blazor application base repository AspnetRunBasics. This code can help other people easy to answer question how implement application with Blazor. Using .NET 6 and Visual Studio 2021 Preview for this repository.

You can find the code in here -> https://github.com/thanhxuanhd/AspnetMicroservices/tree/main/aspnetrun-microservices/WebApps/AspnetRunBasicBlazor


Microservices Observability with Distributed Logging, Health Monitoring, Resilie Preview 02:17

Microservices Observability with Distributed Logging, Health Monitoring, Resilient and Fault Tolerance with using Polly

Deploying Microservices to Kubernetes, Automating with Azure DevOps into AKS Preview 02:15