Enterprise Application Development with C# 9 and .NET 5: Enhance your C# and .NET skills by mastering the process of developing professional-grade web applications

Enterprise Application Development with C# 9 and .NET 5: Enhance your C# and .NET skills by mastering the process of developing professional-grade web applications

Enterprise Application Development with C# 9 and .NET 5: Enhance your C# and .NET skills by mastering the process of developing professional-grade web applications
Автор: Kunani Suneel Kumar, Muthiyalu Bhupesh Guptha, Ravindra Akella, Tamirisa Arun Kumar
Дата выхода: 2021
Издательство: Packt Publishing Limited
Количество страниц: 611
Размер файла: 6.9 MB
Тип файла: PDF
Добавил: codelibs
 Проверить на вирусы  Дополнительные материалы 

Cover....1

Title Page....2

Copyright and Credits....3

Dedication....4

Contributors....5

Table of Contents....8

Preface....18

Section 1: Architecting an Enterprise Application and its Fundamentals....24

Chapter 01: Designing and Architecting an Enterprise Application....26

Technical requirements....27

A primer on common design principles and patterns....27

Design principles....28

Design patterns....31

Understanding common enterprise architectures....35

Common issues with monolithic apps....36

Separation of concerns/single responsibility architecture ....37

Domain-driven architecture....38

Stateless services architecture....38

Event-driven architecture ....39

Data storage and access architecture....40

Resiliency architecture....40

Evolution and operations architecture....41

Identifying enterprise application requirements (business and technical)....42

The application's business requirements....43

The application's technical requirements....43

Architecting an enterprise application....45

Solution structuring for an enterprise application....49

Summary....50

Questions....50

Chapter 02: Introducing .NET 5 Core and Standard....52

Technical requirements....53

Introducing .NET 5....53

Understanding the core features....54

Understanding application frameworks....56

Understanding the core components of .NET....56

Setting up the development environment....58

Understanding the CLI....60

Overview of global.json ....62

What is .NET Standard?....63

Understanding the use of .NET 5 and .NET Standard....64

Understanding .NET 5 cross-platform and cloud application support....66

Cloud support....68

Summary....69

Questions....69

Further reading....70

Chapter 03: Introducing C# 9....72

Technical requirements....73

Understanding Init-only setters....73

Working with record types....74

The with expression....77

Understanding top-level statements....77

Examining objects with pattern matching....79

The constant pattern....79

Type patterns....80

Property patterns....80

Conjunctive and disjunctive patterns....80

Pattern matching with the switch expression....81

Tuple patterns....82

Understanding type inference with target-typed expressions....83

Understanding static anonymous functions....83

Eager initialization with module initializers....84

Summary....85

Questions....86

Section 2: Cross-Cutting Concerns....88

Chapter 04: Threading and Asynchronous Operations....90

Technical requirements....91

Understanding the jargon....91

Demystifying threads, lazy initialization, and ThreadPool....93

Working with System.Threading.Thread....94

ThreadPool....96

Lazy initialization....98

Understanding locks, semaphores, and SemaphoreSlim....103

The critical section and thread safety....103

Introducing locks....104

Mutex (Windows only)....105

Introducing semaphores and SemaphoreSlim....105

Choosing the right synchronization constructs....107

Introducing tasks and parallels....109

Introduction to Task and the TPL....109

Handling task exceptions....112

Implementing task cancellation....113

Implementing continuations....117

SynchronizationContext....119

TaskScheduler....119

Implementing data parallelism....120

Using Parallel LINQ (PLINQ)....122

Introducing async-await....126

The task-based asynchronous pattern....127

Principles of using async-await....129

Async streams with IAsyncEnumerable....135

Wrappers for legacy patterns....137

ThreadPool starvation....140

Using concurrent collections for parallelism....141

ConcurrentDictionary....141

Producer-consumer concurrent collections....146

The BlockingCollection class....151

Summary....153

Questions....154

Further reading....154

Chapter 05: Dependency Injection in .NET....156

Technical requirements....157

What is DI?....157

Types of DI....158

DI in ASP.NET Core 5....160

Understanding service lifetimes....162

Managing application services....171

DI in Razor Pages....176

Using third-party containers....177

Summary....181

Questions....182

Chapter 06: Configuration in .NET Core....184

Technical requirements....185

Understanding configuration....185

Default configuration....186

Adding configurations....189

Reading configurations....191

Leveraging built-in configuration providers....194

Azure Key Vault configuration provider....194

File configuration provider....205

Building a custom configuration provider....208

Configuration source....208

Configuration provider....209

Configuration extension....211

Summary ....213

Questions....214

Further reading....215

Chapter 07: Logging in .NET Core ....216

Technical requirements....217

Characteristics of good logging....217

Understanding the available logging providers....219

Built-in logging providers....220

Third-party logging providers....221

Working with Azure App Service....222

Enabling application logging in Azure App Service....223

Monitoring using metrics....229

Alerting using metrics....233

Real-time telemetry in Azure Application Insights....234

Enabling application logging in Application Insights....236

Creating a .NET 5 logging class library....242

Summary....246

Questions....247

Chapter 08: Understanding Caching....248

Technical requirements....249

Introduction to caching....249

Client caching....250

Content Delivery Network (CDN)....250

Web server caching....251

Database caching....251

Application caching....251

Understanding the components of caching....252

Response caching....252

Distributed caching....256

Cache access patterns....258

Caching platforms....261

In-memory cache....262

Distributed cache....265

Designing a cache abstraction layer using distributed caching....274

Caching considerations....277

Summary....278

Questions....279

Further reading....279

Section 3: Developing Your Enterprise Application....280

Chapter 09: Working with Data in .NET 5....282

Technical requirements....283

Introduction to data....283

Relational Database Management System (RDBMS)....284

NoSQL....285

Disks, files, and directories....286

Handling directories....287

Reading/writing data with streams, binary, and strings....290

Streams....290

Reader/writer....293

TextReader/TextWriter versus BinaryReader/BinaryWriter....297

JSON.NET....297

SQL, Azure Cosmos DB, and Azure Storage....298

SQL Server....299

Azure Cosmos DB....301

Azure Storage....309

Working with EF Core....314

Configuration and querying....314

Code first versus database first....321

Designing a Data access service using Azure Cosmos DB....323

Summary....330

Questions....331

Further reading....332

Chapter 10: Creating an ASP.NET Core 5 Web API....334

Technical requirements....335

Introduction to Representational State Transfer (REST)....335

The REST maturity model....338

Understanding the internals of an ASP.NET Core 5 web API....339

Program and Startup classes....342

Understanding middleware....347

Building a custom middleware....349

Handling requests using controllers and actions....355

Understanding ASP.NET Core routing....355

Attribute-based routing....358

The ControllerBase class, the ApiController attribute, and the ActionResult class....361

Integration with the data layer....363

Creating DTOs....366

Service class contracts....368

The mapper class using AutoMapper....368

HttpClient factory for service-to-service calls....370

Implementing service classes....372

Implementing action methods in the controller....374

Understanding gRPC....378

Building a gRPC server in .NET....379

Building a gRPC client in .NET....381

Testing gRPC services ....383

Summary....384

Questions....384

Further reading....385

Chapter 11: Creating an ASP.NET Core 5 Web Application ....386

Technical requirements....387

Introduction to frontend web development....387

Razor syntax....389

Exploring Razor Pages....391

Exploring the ASP.NET Core MVC website....394

Understanding single-page applications....396

Integrating APIs with the service layer....397

Creating the controller and actions....404

Creating a UI using ASP.NET Core MVC....408

Setting up AdminLTE, the Layout page, and views....410

Understanding Blazor....418

Summary....427

Questions....427

Further reading....428

Section 4: Security....430

Chapter 12: Understanding Authentication....432

Technical requirements....433

Understanding the elements of authentication in .NET 5....433

Introduction to ASP.NET Core Identity....435

Sample implementation....435

Scaffolding....440

Integration with external login providers....442

Understanding OAuth 2.0....443

Tokens....445

Authorization grant types....446

Introduction to Azure AD....447

Azure AD B2C setup....448

Integration of our e-commerce application to Azure AD B2C....460

Introduction to Windows Authentication....462

Understanding best practices to secure client and server applications....464

Summary....465

Questions....465

Further reading....466

Chapter 13: Understanding Authorization....468

Technical requirements....469

Back to a few basics....469

Understanding authorization....470

Simple authorization....471

Enabling authorization globally....472

Role-based authorization....473

Policy-based role authorization....475

Implementing role-based authorization....477

Claim-based authorization....481

Policy-based authorization....483

Requirements....484

Requirement handlers....484

Registering a policy....486

Custom authorization....487

Custom authorization attributes....489

Authorization in client and server applications....491

Assigning roles to users....494

User identity in views....495

Summary....495

Questions....496

Further reading....497

Section 5: Health Checks, Unit Testing, Deployment, and Diagnostics....498

Chapter 14: Health and Diagnostics....500

Technical requirements....501

Introducing health checks....501

The health check API in ASP.NET Core 5....502

Adding a health check endpoint....502

Monitoring dependent URIs....504

Building a custom health check ....506

Monitoring the application with Application Insights....511

Live Metrics....512

Usage analysis with Application Insights....513

Smart Detection....514

Application availability....514

Search....517

Logs....519

Snapshot Debugger....522

Performing remote debugging....528

Summary....529

Questions....529

Further reading....530

Chapter 15: Testing....532

Technical requirements....533

Introducing testing....533

Understanding unit testing....535

Unit testing in Visual Studio....535

Code coverage....542

Understanding functional testing....544

Automating functional test cases....544

Understanding load testing....548

Load testing with JMeter....548

Summary....553

Questions....553

Chapter 16: Deploying the Applications in Azure....556

Technical requirements....557

Introducing Azure DevOps....557

Boards....559

Repos....561

Pipelines....563

Test plans....563

Artifacts....564

Understanding the CI pipeline....564

Understanding the flow and components of a pipeline....565

Understanding the CD pipeline....569

Continuous deployment versus continuous delivery....570

Deploying an ASP.NET 5 application....571

Creating a pipeline for CI and CD....576

Summary....585

Questions....586

Further reading....587

Assessments....588

Chapter 1....588

Chapter 2....588

Chapter 3....588

Chapter 4....589

Chapter 5....589

Chapter 6....589

Chapter 7....589

Chapter 8....590

Chapter 9....590

Chapter 10....590

Chapter 11....590

Chapter 12....590

Chapter 13....591

Chapter 14....591

Chapter 15....591

Chapter 16....591

Why subscribe?....592

About Packt....592

Other Books You May Enjoy....593

Index....596

.NET Core is one of the most popular programming platforms in the world for an increasingly large community of developers thanks to its excellent cross-platform support. This book will show you how to confidently use the features of .NET 5 with C# 9 to build robust enterprise applications.

Throughout the book, you'll work on creating an enterprise app and adding a key component to the app with each chapter, before finally getting it ready for testing and deployment. You'll learn concepts relating to advanced data structures, the Entity Framework Core, parallel programming, and dependency injection. As you progress, you'll cover various authentication and authorization schemes provided by .NET Core to make your apps and APIs secure. Next, you'll build web apps using ASP.NET Core 5 and deploy them on the cloud while working with various cloud components using Azure. The book then shows you how to use the latest Microsoft Visual Studio 2019 and C# 9 to simplify developer tasks, and also explores tips and tricks in Visual Studio 2019 to improve your productivity. Later, you'll discover various testing techniques such as unit testing and performance testing as well as different methods to deploy enterprise apps.

By the end of this book, you'll be able to create enterprise apps using the powerful features of .NET 5 and deploy them on the cloud.

What You Will Learn

  • Design enterprise apps by making the most of the latest features of .NET 5
  • Discover different layers of an app, such as the data layer, API layer, and web layer
  • Explore end-to-end architecture, implement an enterprise web app using .NET and C# 9, and deploy the app on Azure
  • Focus on the core concepts of web application development such as dependency injection, caching, logging, configuration, and authentication, and implement them in .NET 5
  • Integrate the new .NET 5 health and performance check APIs with your app
  • Understand how .NET 5 works and contribute to the .NET 5 platform

Who this book is for

If you are a developer, architect, or senior programmer who wants to leverage the features of .NET 5 and the C# language, as well as grasp essential techniques to build your skills, then this C# .NET 5 book is for you. Beginner to intermediate-level knowledge of the .NET framework and C# programming is required to understand the concepts covered in this book more effectively.


Похожее:

Список отзывов:

Нет отзывов к книге.