Full Download NET Microservices Architecture for Containerized NET Applications Cesar De La Torre PDF DOCX
Full Download NET Microservices Architecture for Containerized NET Applications Cesar De La Torre PDF DOCX
com
https://ebookmeta.com/product/net-microservices-
architecture-for-containerized-net-applications-cesar-de-la-
torre/
OR CLICK HERE
DOWLOAD NOW
https://ebookmeta.com/product/microservices-in-net-second-edition-
christian-horsdal-gammelgaard/
ebookmeta.com
https://ebookmeta.com/product/pro-dynamic-net-4-0-applications-data-
driven-programming-for-the-net-framework-1st-edition-carl-ganz-jr/
ebookmeta.com
https://ebookmeta.com/product/software-architecture-by-example-using-
c-and-net-1st-edition-paul-michaels-2/
ebookmeta.com
https://ebookmeta.com/product/how-it-works-book-of-incredible-
history-20th-edition-2023-how-it-works/
ebookmeta.com
The Story of the Salem Witch Trials 2nd Edition Bryan F Le
Beau
https://ebookmeta.com/product/the-story-of-the-salem-witch-trials-2nd-
edition-bryan-f-le-beau/
ebookmeta.com
https://ebookmeta.com/product/thief-loxley-prep-2-1st-edition-hattie-
jude/
ebookmeta.com
https://ebookmeta.com/product/post-brexit-europe-and-uk-policy-
challenges-towards-iran-and-the-gcc-states-contemporary-gulf-studies/
ebookmeta.com
https://ebookmeta.com/product/seal-team-13-book-2-liberation-1st-
edition-evan-currie/
ebookmeta.com
https://ebookmeta.com/product/champagne-charlie-1st-edition-don-
kladstrup-petie-kladstrup/
ebookmeta.com
Comparative Psychology Evolution and Development of Brain
and Behavior 3rd Edition Mauricio R. Papini
https://ebookmeta.com/product/comparative-psychology-evolution-and-
development-of-brain-and-behavior-3rd-edition-mauricio-r-papini/
ebookmeta.com
EDITION v7.0 - Updated to ASP.NET Core 7.0
To make it easier to get started, the guide focuses on a reference containerized and microservice-
based application that you can explore. The reference application is available at the
eShopOnContainers GitHub repo.
Action links
• This e-book is also available in a PDF format (English version only) Download
Introduction
Enterprises are increasingly realizing cost savings, solving deployment problems, and improving
DevOps and production operations by using containers. Microsoft has been releasing container
innovations for Windows and Linux by creating products like Azure Kubernetes Service and Azure
Service Fabric, and by partnering with industry leaders like Docker, Mesosphere, and Kubernetes.
These products deliver container solutions that help companies build and deploy applications at cloud
speed and scale, whatever their choice of platform or tools.
Docker is becoming the de facto standard in the container industry, supported by the most significant
vendors in the Windows and Linux ecosystems. (Microsoft is one of the main cloud vendors
supporting Docker). In the future, Docker will probably be ubiquitous in any datacenter in the cloud or
on-premises.
After you have studied this guide, your next step would be to learn about production-ready
microservices on Microsoft Azure.
Version
This guide has been revised to cover .NET 7 version along with many additional updates related to
the same “wave” of technologies (that is, Azure and additional third-party technologies) coinciding in
time with the .NET 7 release. That’s why the book version has also been updated to version 7.0.
Additional resources
• Containerized Docker Application Lifecycle with Microsoft Platform and Tools (downloadable
e-book)
https://aka.ms/dockerlifecycleebook
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.
Credits
Co-Authors:
Editors:
Mike Pope
Steve Hoag
Copyright
PUBLISHED BY
All rights reserved. No part of the contents of this book may be reproduced or transmitted in any
form or by any means without the written permission of the publisher.
This book is provided “as-is” and expresses the author’s views and opinions. The views, opinions and
information expressed in this book, including URL and other Internet website references, may change
without notice.
Some examples depicted herein are provided for illustration only and are fictitious. No real association
or connection is intended or should be inferred.
Microsoft and the trademarks listed at https://www.microsoft.com on the “Trademarks” webpage are
trademarks of the Microsoft group of companies.
The Docker whale logo is a registered trademark of Docker, Inc. Used by permission.
All other marks and logos are property of their respective owners.
Contents
Introduction to Containers and Docker ................................................................................ 1
What is Docker? ........................................................................................................................................................................ 2
Choosing Between .NET and .NET Framework for Docker Containers .............................. 9
General guidance ..................................................................................................................................................................... 9
Using third-party .NET libraries or NuGet packages not available for .NET 7 ......................................... 12
.NET and Docker image optimizations for development versus production ........................................... 16
i Contents
Manage state and data in Docker applications ........................................................................................................ 22
The relationship between microservices and the Bounded Context pattern ........................................... 29
Challenge #2: How to create queries that retrieve data from several microservices ............................ 32
The API gateway pattern versus the Direct client-to-microservice communication .................................. 40
ii Contents
Additional resources ....................................................................................................................................................... 58
Orchestrate microservices and multi-container applications for high scalability and availability ....... 66
Step 1. Start coding and create your initial application or service baseline ............................................. 75
Step 3. Create your custom Docker images and embed your application or service in them .......... 83
Step 6. Test your Docker application using your local Docker host ............................................................ 89
iii Contents
Simplified workflow when developing containers with Visual Studio ........................................................ 90
The new world: multiple architectural patterns and polyglot microservices .......................................... 100
The DB connection string and environment variables used by Docker containers ............................. 109
Generating Swagger description metadata from your ASP.NET Core Web API ................................... 111
EF Core InMemory database versus SQL Server running as a container ................................................. 132
Using message brokers and service buses for production systems .......................................................... 134
Implementing an event bus with RabbitMQ for the development or test environment ....................... 138
Implementing the subscription code with the RabbitMQ API ..................................................................... 140
iv Contents
Subscribing to events ........................................................................................................................................................ 141
Implement background tasks in microservices with IHostedService and the BackgroundService class
.................................................................................................................................................................................................... 157
Implementing IHostedService with a custom hosted service class deriving from the
BackgroundService base class................................................................................................................................... 160
Tackle Business Complexity in a Microservice with DDD and CQRS Patterns .............. 182
Apply simplified CQRS and DDD patterns in a microservice............................................................................. 184
Apply CQRS and CQS approaches in a DDD microservice in eShopOnContainers ................................. 186
Use ViewModels specifically made for client apps, independent from domain model constraints
............................................................................................................................................................................................... 189
v Contents
Design a microservice domain model ........................................................................................................................ 199
Seedwork (reusable base classes and interfaces for your domain model) .................................................. 210
How to persist value objects in the database with EF Core 2.0 and later ................................................ 217
Persist value objects as owned entity types in EF Core 2.0 and later ........................................................ 218
Domain events as a preferred way to trigger side effects across multiple aggregates within the
same domain ................................................................................................................................................................... 229
vi Contents
Additional resources ..................................................................................................................................................... 238
Implement the infrastructure persistence layer with Entity Framework Core ............................................ 243
EF DbContext and IUnitOfWork instance lifetime in your IoC container ................................................. 248
Introduction to Azure Cosmos DB and the native Cosmos DB API ........................................................... 256
Implement .NET code targeting MongoDB and Azure Cosmos DB .......................................................... 258
Design the microservice application layer and Web API .................................................................................... 266
Implement the microservice application layer using the Web API ................................................................. 267
Use Dependency Injection to inject infrastructure objects into your application layer ..................... 267
The Command process pipeline: how to trigger a command handler ..................................................... 278
Implement the command process pipeline with a mediator pattern (MediatR) .................................. 281
Apply cross-cutting concerns when processing commands with the Behaviors in MediatR .......... 287
Execution strategies and explicit transactions using BeginTransaction and multiple DbContexts296
vii Contents
Issues with the original HttpClient class available in .NET ............................................................................. 298
Implement HTTP call retries with exponential backoff with IHttpClientFactory and Polly policies ... 304
Implement Circuit Breaker pattern with IHttpClientFactory and Polly ..................................................... 307
Authenticate with an OpenID Connect or OAuth 2.0 Identity provider ................................................... 324
viii Contents
Store application secrets safely during development .......................................................................................... 330
Store secrets with the ASP.NET Core Secret Manager .................................................................................... 331
Use Azure Key Vault to protect secrets at production time .............................................................................. 332
ix Contents
Other documents randomly have
different content
Skunk Band, 251.
Spirits, belief in, 16, 17, 114–18, 134–35, 166, 168, 169, 217, 272.
Suicide, 314.
Swans, 124.
Swallows, 185.
Thimbleberry, 101.
Thrush, olive-backed, 6;
willow, 23, 157, 159, 242.
Trails, Indian, 20, 25, 100, 111, 129, 166, 170, 185, 210.
Twin flower, 6.
Vermin, 199.
Warbler, Macgillivray, 6.
Warbler, myrtle, 6.
Whiskey, 36.
Whistling-All-Night, 192.
Winter-counts, 212.
Wipes-His-Eyes, 260.
Wives, number of, 82;
distant, 83.
Woodcraft, 5.
Woodpecker, 226.
Wren, winter, 6.
This eBook is for the use of anyone anywhere at no cost and with
almost no restrictions whatsoever. You may copy it, give it away or re-
use it under the terms of the Project Gutenberg License included with
this eBook or online at www.gutenberg.org ↗️.
Metadata
Revision History
2022-05-08 Started.
External References
Corrections
1.D. The copyright laws of the place where you are located also
govern what you can do with this work. Copyright laws in most
countries are in a constant state of change. If you are outside
the United States, check the laws of your country in addition to
the terms of this agreement before downloading, copying,
displaying, performing, distributing or creating derivative works
based on this work or any other Project Gutenberg™ work. The
Foundation makes no representations concerning the copyright
status of any work in any country other than the United States.
1.E.6. You may convert to and distribute this work in any binary,
compressed, marked up, nonproprietary or proprietary form,
including any word processing or hypertext form. However, if
you provide access to or distribute copies of a Project
Gutenberg™ work in a format other than “Plain Vanilla ASCII” or
other format used in the official version posted on the official
Project Gutenberg™ website (www.gutenberg.org), you must, at
no additional cost, fee or expense to the user, provide a copy, a
means of exporting a copy, or a means of obtaining a copy upon
request, of the work in its original “Plain Vanilla ASCII” or other
form. Any alternate format must include the full Project
Gutenberg™ License as specified in paragraph 1.E.1.
• You pay a royalty fee of 20% of the gross profits you derive from
the use of Project Gutenberg™ works calculated using the
method you already use to calculate your applicable taxes. The
fee is owed to the owner of the Project Gutenberg™ trademark,
but he has agreed to donate royalties under this paragraph to
the Project Gutenberg Literary Archive Foundation. Royalty
payments must be paid within 60 days following each date on
which you prepare (or are legally required to prepare) your
periodic tax returns. Royalty payments should be clearly marked
as such and sent to the Project Gutenberg Literary Archive
Foundation at the address specified in Section 4, “Information
about donations to the Project Gutenberg Literary Archive
Foundation.”
• You comply with all other terms of this agreement for free
distribution of Project Gutenberg™ works.
1.F.