Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Building Microservices with .NET Core 2.0
Building Microservices with .NET Core 2.0

Building Microservices with .NET Core 2.0: Transitioning monolithic architectures using microservices with .NET Core 2.0 using C# 7.0 , Second Edition

eBook
€29.99
Paperback
€36.99
Subscription
Free Trial
Renews at €18.99p/m

What do you get with eBook?

Product feature icon Instant access to your Digital eBook purchase
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
Table of content icon View table of contents Preview book icon Preview Book

Building Microservices with .NET Core 2.0

Implementing Microservices

In the previous chapter, we discussed the problems of a layered monolith architecture. In this chapter, we will discuss how we can refactor them from the existing system and build separate microservices for products and orders. In this chapter, we will cover the following topics:

  • Introduction to C# 7.0, Entity Framework Core, Visual Studio 2017, and Microsoft SQLServer
  • Size of microservices
  • What makes a good service?
  • Domain-driven design (DDD) and its importance for microservices
  • The concept of Seam
  • Communication between microservices
  • Revisiting the Flix One case study

Introduction

Before we proceed with the concepts to implement microservices, it is worth mentioning the core concepts, languages, and tools that we're using to implement these microservices. In this chapter, we will get an overview of these topics.

C# 7.0

C# is a programming language developed by Microsoft. The current release at the time of writing this book is C# 7.0. The language appeared in 2002. This language is an object-oriented language and component-oriented. The current version has various new features such as ValueTuple, Deconstructors, pattern matching, the switch statement local function, and so on.

We are not going into details of these features as it's beyond the scope of this book. Refer to https...

Size of microservices

Before we start building our microservices, we should be clear about a few of their basic aspects, such as what factors to consider while sizing our microservices and how to ensure their isolation from the rest of the system.

As the name suggests, microservices should be micro. A question arises: what is micro? Microservices are all about size and granularity. To understand this better, let's consider the application discussed in Chapter 1, An Introduction to Microservices.

We wanted the teams working on this project to stay synchronized at all times with respect to their code. Staying synchronized is even more important when we release the complete project. We needed to first decompose our application/specific parts into smaller functionalities/segments of the main service. Let's discuss the factors that need to be considered for the high-level...

What makes a good service?

Before microservices were conceptualized, whenever we thought of enterprise application integration, middleware looked like the most feasible option. Software vendors offered Enterprise Service Bus (ESB), and it was one of the best options for middleware.

Besides considering these solutions, our main priority should be inclined toward the architectural features. When microservices arrived, middleware was no longer a consideration. Rather, the focus shifted to contemplation of business problems and how to tackle those problems with the help of the architecture.

In order to make a service that can be used and maintained easily by developers and users, the service must have the following features (we can also consider these as characteristics of good services):

  • Standard data formats: Good services should follow standardized data formats while exchanging...

DDD and its importance for microservices

Domain-Driven Design (DDD) is a methodology and a process of designing complex systems. In these sections, we will briefly discuss DDD and how it is important in the context of microservices.

Domain model design

The main objective of domain design is to understand the exact domain problems and then draft a model that can be written in any language or set of technologies. For example, in our Flix One bookstore application, we need to understand Order Management and Stock Management.

Here are a few characteristics of the domain-driven model:

  • A domain model should focus on a specific business model and not multiple business models
  • It should be reusable
  • It should be designed so that it...

The concept of seam

At the very core of microservices lies the capability to work on a specific functionality in isolation from the rest of the system. This translates into all the advantages discussed earlier, such as reduced module dependency, code reusability, easier code maintenance, and better deployment.

In my opinion, the same attributes that were attained with the implementation of microservices should be maintained during the process of implementation. Why should the whole process of moving monoliths to microservices be painful and not be as rewarding as using the microservices themselves? Just remember that the transition can't be done overnight and will need meticulous planning. Many capable solution architects have differed in their approaches while presenting their highly capable teams. The answer lies not just in the points already mentioned, but in the risk...

Communication between microservices

In the preceding section, we separated our Order module into Order services and discussed how we can break down the foreign key relationship between ORDER and PRODUCT tables.

In a monolithic application, we have a single repository that queries the database to fetch the records from both ORDER and PRODUCT tables. However, in our upcoming microservice application, we will segregate repositories between Order service and Product service. With each service having its respective database, each one would access its own database only. Order service would only be able to access order Database, whereas Product service would be able to access product Database only. Order service should not be allowed to access product Database and vice versa.

We will discuss communication between microservices in Chapter 3, Integration Techniques and Microservices,...

Revisiting the Flix One case study

In the preceding chapter, we looked at an example of an imaginary company, Flix One Inc., operating in the e-commerce domain and having its own .NET monolithic application: the Flix One bookstore. We have already discussed the following:

  • How to segregate the code
  • How to segregate the database
  • How to denormalize the database
  • How to begin transitioning
  • The available refactoring approaches

In the next sections, we will start writing/transitioning .NET monolith to a microservice application.

Prerequisites

We will use the following tools and technologies while transitioning our monolithic application to microservice-style architecture:

  • Visual Studio 2017 update 3 or later
  • C# 7.0
  • ASP.NET Core...

Summary

In this chapter, we discussed the different factors that can be used to identify and isolate microservices at a high level. We also discussed the various characteristics of a good service. When talking about DDD, we learned its importance in the context of microservices.

Furthermore, we analyzed how we can correctly achieve the vertical isolation of microservices through various parameters in detail. We tried to draw on our previous understanding of the challenges posed by a monolithic application and its solution in microservices, and we learned that we can use factors such as module interdependency, technology utilization, and team structure to identify seams and perform the transition from a monolithic architecture to microservices in an organized manner.

It became apparent that the database can pose a clear challenge in this process. However, we identified how we can...

Left arrow icon Right arrow icon

Key benefits

  • Start your microservices journey and get a broader perspective on microservices development using C# 7.0 with .NET Core 2.0
  • Build, deploy, and test microservices using ASP.Net Core, ASP.NET Core API, and Microsoft Azure Cloud
  • Get the basics of reactive microservices

Description

The microservices architectural style promotes the development of complex applications as a suite of small services based on business capabilities. This book will help you identify the appropriate service boundaries within your business. We'll start by looking at what microservices are and their main characteristics. Moving forward, you will be introduced to real-life application scenarios; after assessing the current issues, we will begin the journey of transforming this application by splitting it into a suite of microservices using C# 7.0 with .NET Core 2.0. You will identify service boundaries, split the application into multiple microservices, and define service contracts. You will find out how to configure, deploy, and monitor microservices, and configure scaling to allow the application to quickly adapt to increased demand in the future. With an introduction to reactive microservices, you’ll strategically gain further value to keep your code base simple, focusing on what is more important rather than on messy asynchronous calls.

Who is this book for?

This book is for .NET Core developers who want to learn and understand the microservices architecture and implement it in their .NET Core applications. It’s ideal for developers who are completely new to microservices or just have a theoretical understanding of this architectural approach and want to gain a practical perspective in order to better manage application complexities.

What you will learn

  • Get acquainted with Microsoft Azure Service Fabric
  • Compare microservices with monolithic applications and SOA
  • Learn Docker and Azure API management
  • Define a service interface and implement APIs using ASP.NET Core 2.0
  • Integrate services using a synchronous approach via RESTful APIs with ASP.NET Core 2.0
  • Implement microservices security using Azure Active Directory, OpenID Connect, and OAuth 2.0
  • Understand the operation and scaling of microservices in .NET Core 2.0
  • Understand the key features of reactive microservices and implement them using reactive extensions

Product Details

Country selected
Publication date, Length, Edition, Language, ISBN-13
Publication date : Dec 22, 2017
Length: 300 pages
Edition : 2nd
Language : English
ISBN-13 : 9781788399968
Languages :
Concepts :
Tools :

What do you get with eBook?

Product feature icon Instant access to your Digital eBook purchase
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want

Product Details

Publication date : Dec 22, 2017
Length: 300 pages
Edition : 2nd
Language : English
ISBN-13 : 9781788399968
Languages :
Concepts :
Tools :

Packt Subscriptions

See our plans and pricing
Modal Close icon
€18.99 billed monthly
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Simple pricing, no contract
€189.99 billed annually
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just €5 each
Feature tick icon Exclusive print discounts
€264.99 billed in 18 months
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just €5 each
Feature tick icon Exclusive print discounts

Frequently bought together


Stars icon
Total 133.97
Building Microservices with .NET Core 2.0
€36.99
Learning ASP.NET Core 2.0
€36.99
C# 7.1 and .NET Core 2.0 ??? Modern Cross-Platform Development
€59.99
Total 133.97 Stars icon

Table of Contents

10 Chapters
An Introduction to Microservices Chevron down icon Chevron up icon
Implementing Microservices Chevron down icon Chevron up icon
Integration Techniques and Microservices Chevron down icon Chevron up icon
Testing Microservices Chevron down icon Chevron up icon
Deploying Microservices Chevron down icon Chevron up icon
Securing Microservices Chevron down icon Chevron up icon
Monitoring Microservices Chevron down icon Chevron up icon
Scaling Microservices Chevron down icon Chevron up icon
Introduction to Reactive Microservices Chevron down icon Chevron up icon
Creating a Complete Microservice Solution Chevron down icon Chevron up icon

Customer reviews

Top Reviews
Rating distribution
Full star icon Full star icon Full star icon Half star icon Empty star icon 3.2
(15 Ratings)
5 star 33.3%
4 star 20%
3 star 6.7%
2 star 13.3%
1 star 26.7%
Filter icon Filter
Top Reviews

Filter reviews by




Nidhi malwe Jan 22, 2018
Full star icon Full star icon Full star icon Full star icon Full star icon 5
This is an excellent book. I have completed reading half of the book on day 1 itself
Amazon Verified review Amazon
Ashutosh Upmanyu Jan 09, 2018
Full star icon Full star icon Full star icon Full star icon Full star icon 5
A book to look out, for those who want to have knowledge in microservices and SOA. Topics have been covered with real code examples and images/diagrams. A well written book to build your base in microservices.
Amazon Verified review Amazon
Dani Mago Feb 11, 2018
Full star icon Full star icon Full star icon Full star icon Full star icon 5
I'm starting to read it and I found it very simple to understand, if you are looking for a starting guide this is for you.
Amazon Verified review Amazon
Amit Seth Feb 11, 2018
Full star icon Full star icon Full star icon Full star icon Full star icon 5
A great read for someone get started on fundamentals and implementation aspects of microservices. With the world moving to single responsibility principle this is a perfect crawl walk run guide.
Amazon Verified review Amazon
Dheeraj M. Feb 11, 2018
Full star icon Full star icon Full star icon Full star icon Full star icon 5
A good book if want to start microwave from scratch. .net core and c# based examples help to understand.
Amazon Verified review Amazon
Get free access to Packt library with over 7500+ books and video courses for 7 days!
Start Free Trial

FAQs

How do I buy and download an eBook? Chevron down icon Chevron up icon

Where there is an eBook version of a title available, you can buy it from the book details for that title. Add either the standalone eBook or the eBook and print book bundle to your shopping cart. Your eBook will show in your cart as a product on its own. After completing checkout and payment in the normal way, you will receive your receipt on the screen containing a link to a personalised PDF download file. This link will remain active for 30 days. You can download backup copies of the file by logging in to your account at any time.

If you already have Adobe reader installed, then clicking on the link will download and open the PDF file directly. If you don't, then save the PDF file on your machine and download the Reader to view it.

Please Note: Packt eBooks are non-returnable and non-refundable.

Packt eBook and Licensing When you buy an eBook from Packt Publishing, completing your purchase means you accept the terms of our licence agreement. Please read the full text of the agreement. In it we have tried to balance the need for the ebook to be usable for you the reader with our needs to protect the rights of us as Publishers and of our authors. In summary, the agreement says:

  • You may make copies of your eBook for your own use onto any machine
  • You may not pass copies of the eBook on to anyone else
How can I make a purchase on your website? Chevron down icon Chevron up icon

If you want to purchase a video course, eBook or Bundle (Print+eBook) please follow below steps:

  1. Register on our website using your email address and the password.
  2. Search for the title by name or ISBN using the search option.
  3. Select the title you want to purchase.
  4. Choose the format you wish to purchase the title in; if you order the Print Book, you get a free eBook copy of the same title. 
  5. Proceed with the checkout process (payment to be made using Credit Card, Debit Cart, or PayPal)
Where can I access support around an eBook? Chevron down icon Chevron up icon
  • If you experience a problem with using or installing Adobe Reader, the contact Adobe directly.
  • To view the errata for the book, see www.packtpub.com/support and view the pages for the title you have.
  • To view your account details or to download a new copy of the book go to www.packtpub.com/account
  • To contact us directly if a problem is not resolved, use www.packtpub.com/contact-us
What eBook formats do Packt support? Chevron down icon Chevron up icon

Our eBooks are currently available in a variety of formats such as PDF and ePubs. In the future, this may well change with trends and development in technology, but please note that our PDFs are not Adobe eBook Reader format, which has greater restrictions on security.

You will need to use Adobe Reader v9 or later in order to read Packt's PDF eBooks.

What are the benefits of eBooks? Chevron down icon Chevron up icon
  • You can get the information you need immediately
  • You can easily take them with you on a laptop
  • You can download them an unlimited number of times
  • You can print them out
  • They are copy-paste enabled
  • They are searchable
  • There is no password protection
  • They are lower price than print
  • They save resources and space
What is an eBook? Chevron down icon Chevron up icon

Packt eBooks are a complete electronic version of the print edition, available in PDF and ePub formats. Every piece of content down to the page numbering is the same. Because we save the costs of printing and shipping the book to you, we are able to offer eBooks at a lower cost than print editions.

When you have purchased an eBook, simply login to your account and click on the link in Your Download Area. We recommend you saving the file to your hard drive before opening it.

For optimal viewing of our eBooks, we recommend you download and install the free Adobe Reader version 9.