Book Image

Hands-On Microservices with C# 8 and .NET Core 3 - Third Edition

By : Gaurav Aroraa, Ed Price
Book Image

Hands-On Microservices with C# 8 and .NET Core 3 - Third Edition

By: Gaurav Aroraa, Ed Price

Overview of this book

<p>The microservice architectural style promotes the development of complex applications as a suite of small services based on specific business capabilities. With this book, you'll take a hands-on approach to build microservices and deploy them using ASP .NET Core and Microsoft Azure. </p><p>You'll start by understanding the concept of microservices and their fundamental characteristics. This microservices book will then introduce a real-world app built as a monolith, currently struggling under increased demand and complexity, and guide you in its transition to microservices using the latest features of C# 8 and .NET Core 3. You'll identify service boundaries, split the application into multiple microservices, and define service contracts. You'll also explore how to configure, deploy, and monitor microservices using Docker and Kubernetes, and implement autoscaling in a microservices architecture for enhanced productivity. Once you've got to grips with reactive microservices, you'll discover how keeping your code base simple enables you to focus on what's important rather than on messy asynchronous calls. Finally, you'll delve into various design patterns and best practices for creating enterprise-ready microservice applications. </p><p>By the end of this book, you'll be able to deconstruct a monolith successfully to create well-defined microservices.</p>
Table of Contents (16 chapters)

To get the most out of this book

This book assumes that you have some familiarity with SOA, RESTful web services, APIs, server/client architectures, .NET Core, ASP.NET Core, and C#. This book covers advanced topics, basic concepts, and an overview of technologies such as Kubernetes and IoT Edge. The book's contents are designed to get you started with the development of a microservices-based application. It can also be used as a comprehensive guide. Using a toolbox analogy, the book provides a large number of tools for the modern application developer, progressing from low-level code design to higher-level architecture, as well as important concepts, patterns, and best practices commonly used today for the development of microservices-based applications.

This book will cover the following main points:

  • The details of microservices, including in-depth details of monolith versus SOA versus microservices architectures
  • Examples using C#8 and ASP.NET Core 3
  • An overview of the current application stack and the new stack to develop microservices via an imaginary application
  • In-depth discussion of design patterns and best practices using demo application

You need to install Visual Studio 2019 (Community edition preferably) with the latest update. All code examples have been tested using .NET Core 3.1 on Windows OS. However, they should work with future version releases too.

Software/Hardware covered in the book OS requirements
ASP.NET Core 3.1 Windows
C# 8 Windows
SQL Server 2008R2 Windows
SQL Server 2017 Windows

 

If you are using the digital version of this book, we advise you to type the code yourself or access the code via the GitHub repository (link available in the next section). Doing so will help you avoid any potential errors related to copy/pasting of code.

Few of the code example uses Angular 8  to showcase the UI part. There is no code for these component as these are only for UI and you would require to setup Angular 8 on your Windows OS.

Download the example code files

You can download the example code files for this book from your account at www.packt.com. If you purchased this book elsewhere, you can visit www.packt.com/support and register to have the files emailed directly to you.

You can download the code files by following these steps:

  1. Log in or register at www.packt.com.
  2. Select the SUPPORT tab.
  3. Click on Code Downloads & Errata.
  4. Enter the name of the book in the Search box and follow the onscreen instructions.

Once the file is downloaded, please make sure that you unzip or extract the folder using the latest version of:

  • WinRAR/7-Zip for Windows
  • Zipeg/iZip/UnRarX for Mac
  • 7-Zip/PeaZip for Linux

The code bundle for the book is also hosted on GitHub at https://github.com/PacktPublishing/Hands-On-Microservices-with-CSharp-8-and-.NET-Core-3-Third-EditionIn case there's an update to the code, it will be updated on the existing GitHub repository.

We also have other code bundles from our rich catalog of books and videos available at https://github.com/PacktPublishing/. Check them out!

Download the color images

Conventions used

There are a number of text conventions used throughout this book.

CodeInText: Indicates code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles. Here is an example: "The preceding code declares two readonly properties with preassigned values."

A block of code is set as follows:

Range book = 1..4;
var res = Books[book] ;
Console.WriteLine($"\tElement of array using Range: Books[{book}] => {Books[book]}");

When we wish to draw your attention to a particular part of a code block, the relevant lines or items are set in bold:

private static readonly int num1=5;
private static readonly int num2=6;

Any command-line input or output is written as follows:

dotnet --info

Bold: Indicates a new term, an important word, or words that you see on screen. For example, words in menus or dialog boxes appear in the text like this. Here is an example: "Select System info from the Administration panel."

Warnings or important notes appear like this.
Tips and tricks appear like this.