Hands-On Software Architecture with C# 8 and .NET Core 3

This document was uploaded by one of our users. The uploader already confirmed that they had the permission to publish it. If you are author/publisher or own the copyright of this documents, please report to us by using this DMCA report form.

Simply click on the Download Book button.

Yes, Book downloads on Ebookily are 100% Free.

Sometimes the book is free on Amazon As well, so go ahead and hit "Search on Amazon"

Author(s): Gabriel Baptista, Francesco Abbruzzese
Publisher: Packt Publishing
Year: November 2019

Language: English
Pages: 586

Cover......Page 1
Title Page......Page 2
Copyright and Credits......Page 3
About Packt......Page 4
Contributors......Page 5
Table of Contents......Page 7
Preface......Page 17
Section 1: Transforming Customer Needs in Real-World Applications......Page 23
Chapter 1: Understanding the Importance of Software Architecture......Page 25
What is software architecture?......Page 26
Creating an Azure account......Page 28
Understanding the waterfall model principles......Page 30
Analyzing the incremental model......Page 31
Understanding agile software development process models......Page 32
Getting into the Scrum model......Page 33
Understanding the requirements gathering process......Page 34
Practicing the elicitation of user needs......Page 35
Analyzing requirements......Page 36
Reviewing the specification......Page 37
Using design thinking as a helpful tool......Page 38
Understanding the principles of scalability, robustness, security, and performance......Page 39
Case 1 – my website is too slow to open that page!......Page 40
Dealing with object allocation......Page 41
Getting better database access......Page 42
Case 2 – the user's needs are not properly implemented......Page 43
Case study – detecting user needs......Page 44
Book case study – introducing World Wild Travel Club......Page 45
Book case study – understanding user needs and system requirements......Page 46
Questions......Page 48
Further reading......Page 49
Chapter 2: Functional and Nonfunctional Requirements......Page 50
How does scalability interact with Azure and .NET Core?......Page 51
Creating a scalable web app in Azure......Page 52
Vertical scaling (Scale up)......Page 55
Horizontal scaling (Scale out)......Page 57
Creating a scalable web app with .NET Core......Page 58
Performance issues that need to be considered when programming in C#......Page 62
String concatenation......Page 63
Exceptions......Page 64
Multithreading environments for better results – do's and don'ts......Page 65
Usability – why inserting data takes too much time......Page 68
Designing fast selection logic......Page 69
Selecting from a huge amount of items......Page 73
The fantastic world of interoperability with .NET Core......Page 74
Creating a service in Linux......Page 76
Book use case – understanding the main types of .NET Core projects......Page 77
Questions......Page 79
Further reading......Page 80
Introducing Azure DevOps......Page 81
Organizing your work using Azure DevOps......Page 86
Azure DevOps repository......Page 87
Package feeds......Page 89
Test plans......Page 91
Pipelines......Page 92
Managing system requirements in Azure DevOps......Page 93
Features work items......Page 94
Product Backlog items/User Story work items......Page 95
Book use case – presenting use cases in Azure DevOps......Page 96
Summary......Page 100
Further reading......Page 101
Section 2: Architecting Software Solutions in a Cloud-Based Environment......Page 102
Technical requirements......Page 104
Infrastructure as a service and Azure opportunities......Page 105
Security responsibility in IaaS......Page 107
PaaS – a world of opportunities for developers......Page 108
Web apps......Page 109
Azure SQL Server......Page 110
Azure Cognitive Services......Page 112
Understanding what serverless means......Page 116
Why are hybrid applications so useful in many cases?......Page 117
Use case – a hybrid application......Page 118
Book use case – which is the best cloud platform for this use case?......Page 119
Questions......Page 120
Further reading......Page 121
Chapter 5: Applying a Microservice Architecture to Your Enterprise Application......Page 122
What are microservices?......Page 123
Microservices and the evolution of the concept of modules......Page 125
Microservice design principles......Page 126
Containers and Docker......Page 130
Layered architectures and microservices......Page 132
When is it worth considering microservice architectures?......Page 135
How does .NET Core deal with microservices?......Page 136
.NET Core communication facilities......Page 137
Resilient task execution......Page 139
Using generic hosts......Page 141
Visual Studio support for Docker......Page 145
Azure and Visual Studio support for microservice orchestration......Page 150
Defining your private Docker registry in Azure......Page 153
Azure Service Fabric......Page 155
Step 1: Basic information......Page 156
Step 2: Cluster configuration......Page 157
Step 3: Security configuration......Page 159
Azure Kubernetes Service (AKS)......Page 162
Use case – logging microservices......Page 166
Ensuring message idempotency......Page 170
The Interaction library......Page 173
Implementing the receiving side of communication......Page 175
Implementing service logic......Page 178
Defining the microservice's host......Page 184
Communicating with the service......Page 185
Summary......Page 187
Further reading......Page 188
Chapter 6: Interacting with Data in C# - Entity Framework Core......Page 190
Understanding ORM basics......Page 191
Configuring Entity Framework Core......Page 194
Defining DB entities......Page 195
Defining the mapped collections......Page 198
Completing the mapping configuration......Page 199
Entity Framework Core migrations......Page 200
Understanding stored procedures and direct SQL commands......Page 204
Querying and updating data with Entity Framework Core......Page 205
Returning data to the presentation layer......Page 208
Issuing direct SQL commands......Page 209
Deploying your data layer......Page 211
Understanding Entity Framework Core advanced feature – global filters......Page 212
Summary......Page 213
Further reading......Page 214
Chapter 7: How to Choose Your Data Storage in the Cloud......Page 215
Understanding the different repositories for different purposes......Page 216
Relational databases......Page 217
NoSQL databases......Page 219
Redis......Page 220
Choosing between structured or NoSQL storage......Page 222
Azure Cosmos DB – an opportunity to manage a multi-continental database......Page 224
Cosmos DB client......Page 231
Cosmos DB Entity Framework Core provider......Page 232
Use case – storing data......Page 233
Implementing the destinations/packages database with Cosmos DB......Page 234
Questions......Page 239
Further reading......Page 240
Technical requirements......Page 241
Understanding the Azure Functions App......Page 242
App Service Plan......Page 243
Programming Azure Functions using C#......Page 244
Listing Azure Functions templates......Page 248
Maintaining Azure Functions......Page 249
Use case – implementing Azure Functions to send emails......Page 251
First Step – creating Azure Queue Storage......Page 253
Questions......Page 259
Further reading......Page 260
Section 3: Applying Design Principles for Software Delivered in the 21st Century......Page 261
Technical requirements......Page 263
Understanding design patterns and their purpose......Page 264
Builder pattern......Page 265
Factory pattern......Page 267
Singleton pattern......Page 268
Proxy pattern......Page 271
Command pattern......Page 273
Publisher/Subscriber pattern......Page 275
Dependency Injection pattern......Page 276
Understanding the available design patterns in .NET Core......Page 278
Questions......Page 279
Further reading......Page 280
Chapter 10: Understanding the Different Domains in Software Solutions......Page 281
What are software domains?......Page 282
Understanding domain-driven design......Page 285
Entities and value objects......Page 289
Using SOLID principles to map your domains......Page 293
Aggregates......Page 295
The repository and Unit of Work patterns......Page 296
DDD entities and Entity Framework Core......Page 298
Command Query Responsibility Segregation (CQRS) pattern......Page 299
Command handlers and domain events......Page 302
Event sourcing......Page 305
Use case – understanding the domains of the use case......Page 306
Summary......Page 309
Further reading......Page 310
Technical requirements......Page 311
What is not code reuse?......Page 312
What is code reuse?......Page 314
Inserting reusability into your development cycle......Page 315
Creating a .NET Standard library......Page 316
Object-oriented analysis......Page 318
Generics......Page 320
Use case – reusing code as a fast track to deliver good and safe software......Page 321
Summary......Page 322
Further reading......Page 323
Chapter 12: Applying Service-Oriented Architectures with .NET Core......Page 324
Understanding the principles of the SOA approach......Page 325
SOAP web services......Page 329
REST web services......Page 331
REST services authorization and authentication......Page 337
How does .NET Core deal with SOA?......Page 340
A short introduction to ASP.NET Core......Page 342
Implementing REST services with ASP.NET Core......Page 346
ASP.NET Core service authorization......Page 350
ASP.NET Core support for OpenAPI......Page 353
.Net Core HTTP clients......Page 357
Use case – exposing WWTravelClub packages......Page 360
Questions......Page 366
Further reading......Page 367
Chapter 13: Presenting ASP.NET Core MVC......Page 368
Understanding the presentation layers of web applications......Page 369
How ASP.NET Core pipeline works......Page 370
Loading configuration data and using it with the options framework......Page 374
Defining the ASP.NET Core MVC pipeline......Page 379
Defining controllers and ViewModels......Page 384
Understanding Razor Views......Page 389
Learning Razor flow of control statements......Page 390
Understanding Razor View properties......Page 392
Using Razor tag helpers......Page 393
Reusing view code......Page 397
What is new in .NET Core 3.0 for ASP.NET Core?......Page 401
Understanding the connection between ASP.NET Core MVC and design principles......Page 403
Server-side and client-side validation......Page 404
ASP.NET Core globalization......Page 405
The MVC pattern......Page 410
Defining application specifications......Page 411
Defining the application architecture......Page 412
Defining the domain layer......Page 415
Defining the data layer......Page 418
Defining the application layer......Page 423
Controllers and views......Page 428
Questions......Page 434
Further reading......Page 435
Section 4: Programming Solutions for an Unavoidable Future Evolution......Page 436
Technical requirements......Page 437
The more complex your code is, the worse a programmer you are......Page 438
Cyclomatic complexity......Page 439
Depth of inheritance......Page 443
Class coupling......Page 444
Using a version control system......Page 446
try-catch......Page 447
try-finally and using......Page 448
.NET Core tips and tricks for coding......Page 450
WWTravelClub – dos and don'ts in writing code......Page 452
Further reading......Page 453
Chapter 15: Testing Your Code with Unit Test Cases and TDD......Page 455
Understanding automated tests......Page 456
Writing automated (unit and integration) tests......Page 458
Writing acceptance and performance tests......Page 460
Understanding test-driven development (TDD)......Page 461
Defining C# test projects......Page 464
Using the xUnit test framework......Page 465
Advanced test preparation and tear-down scenarios......Page 467
Mocking interfaces with Moq......Page 469
Use case – automating unit tests in DevOps Azure......Page 471
Summary......Page 479
Further reading......Page 480
Chapter 16: Using Tools to Write Better Code......Page 481
Identifying a well-written code......Page 482
Understanding and applying tools that can evaluate C# code......Page 484
Using Microsoft Code Analysis 2019......Page 488
Applying SonarLint for Visual Studio 2019......Page 490
Checking the final code after analysis......Page 491
Use case – evaluating the C# code before publishing the application......Page 493
Questions......Page 495
Further reading......Page 496
Section 5: Delivering Software Continuously and at a High Quality Level......Page 497
Chapter 17: Deploying Your Application with Azure DevOps......Page 499
Adapting your organization to a service scenario......Page 500
Technical implications of a service scenario......Page 501
Adopting a SaaS solution......Page 502
Preparing a solution for a service scenario......Page 503
Creating the Azure Web App and the Azure database......Page 506
Configuring your Visual Studio solution......Page 508
Configuring Azure Pipelines......Page 509
Adding a manual approval for the release......Page 512
Creating a release......Page 514
Summary......Page 516
Further reading......Page 517
Chapter 18: Understanding DevOps Principles......Page 518
Describing DevOps......Page 519
Defining continuous integration......Page 520
Understanding continuous delivery and multistage environment with Azure DevOps......Page 521
Defining continuous feedback and the related DevOps tools ......Page 524
Monitoring you software with Application Insights......Page 525
Using the Test and Feedback tool to enable feedback......Page 531
The WWTravelClub project approach......Page 536
Questions......Page 537
Further Reading......Page 538
Chapter 19: Challenges of Applying CI Scenarios in DevOps......Page 539
Understanding CI......Page 540
Understanding the risks and challenges when using CI......Page 541
Disabling continuous production deployment......Page 542
Incomplete features......Page 543
Unstable solution for testing......Page 546
Summary......Page 550
Further reading......Page 551
Technical requirements......Page 552
Understanding the purpose of functional tests......Page 553
Using unit testing tools to automate functional tests in C#......Page 555
Testing the staging application......Page 556
Testing a controlled application......Page 557
Use case – automating functional tests......Page 559
Further reading......Page 563
Chapter 2......Page 564
Chapter 4......Page 565
Chapter 6......Page 566
Chapter 8......Page 567
Chapter 9......Page 568
Chapter 11......Page 569
Chapter 13......Page 570
Chapter 15......Page 571
Chapter 17......Page 572
Chapter 19......Page 573
Chapter 20......Page 574
Other Books You May Enjoy......Page 575
Index......Page 578