Modernizing .NET Web Applications: Everything You Need to Know About Migrating ASP.NET Web Applications to the Latest Version of .NET

Modernizing .NET Web Applications: Everything You Need to Know About Migrating ASP.NET Web Applications to the Latest Version of .NET

Modernizing .NET Web Applications: Everything You Need to Know About Migrating ASP.NET Web Applications to the Latest Version of .NET
Автор: Herceg Tomáš
Дата выхода: 2024
Издательство: Apress Media, LLC.
Количество страниц: 672
Размер файла: 3,9 МБ
Тип файла: PDF
Добавил: codelibs
 Проверить на вирусы  Дополнительные материалы 

Table of Contents....4

About the Author....11

About the Technical Reviewer....12

Acknowledgments....13

Chapter 1: Introduction....15

The New Generation of .NET....16

Bridging the Gap with .NET Standard....17

What Has Changed....19

Ten Thousand Feet View of the Book....22

Get Ready....24

About the Author....25

Application Framework Equivalents in the .NET Core World....28

Frameworks for Web UI....29

ASP.NET Web Forms....29

ASP.NET MVC....31

ASP.NET Web Pages....34

Communication Frameworks....35

ASP.NET XML Web Services....36

Windows Communication Foundation....37

ASP.NET Web API....39

ASP.NET SignalR....40

Data Access Libraries....42

LINQ to SQL....44

Entity Framework....45

Membership and Identity....47

Membership Providers....48

ASP.NET Identity....49

Other Unsupported Technologies and APIs....51

Summary....53

Chapter 2: Justifying the Modernization....56

To Modernize or Not to Modernize....57

Example 1: Application in Maintenance Mode with a Negligible Number of New Requirements....57

Example 2: Complex and Actively Developed Admin Portal....58

Example 3: Ecommerce Solution Transformed into Multiple Applications....60

Takeaways....63

Benefits of the New .NET....64

Technical Arguments....64

Performance Improvements....65

Just-In-Time Compiler....66

Tiered Compilation....67

Inlining....69

Other JIT Improvements....72

Vectorization....73

Garbage Collector....74

New Performance-Related Types....75

Span and Memory....75

Allocation-Free Parsing....80

ValueTask....85

Source Generators....87

New JSON Parser....88

Optimizations in Base Types and Collections....91

Parsing and Formatting....91

Vectorization for Strings....91

Collections....95

Summary....98

Developer Productivity....99

Better Developer Tools....99

Hot Reload....101

Version Control....103

Package References....106

SDK-Style Projects....108

Entity Framework Migrations....111

Support for Linux and Containers....111

Architectural Improvements....114

Configuration....115

Dependency Injection....120

Logging....124

Hosting....127

Other Packages....130

Conclusion....132

Nontechnical Arguments....132

Hiring and Motivation of Developers....133

Higher Operating and Maintenance Costs....135

Security Considerations....138

Summary....142

Chapter 3: Before You Start....143

Choosing the Right Strategy....143

Example: Modernizing a Large E-learning Website....145

Incremental Changes....149

In-Place Modernization....151

Side-by-Side Modernization....158

Full Rewrite....164

Back to the Example....167

Estimating the Effort....169

Divide and Conquer....170

Example: Estimating the Effort....171

Preparing the Environment....176

Cleanup....177

Review Project Dependencies....178

Monitoring and Diagnostics....181

Version Control....183

Git Workflows....184

GitHub Flow....185

Gitflow....186

Trunk-Based Development....187

Conclusion....187

Summary....188

Chapter 4: Migrating APIs and Web Services....190

Before You Start....191

Refactoring on the Way....194

ASP.NET XML Web Services....196

Migrating to SoapCore....198

SOAP Extensions....203

Authentication....204

Migrating to gRPC....207

Windows Communication Foundation....214

Migrating to CoreWCF....216

Authentication....223

Unsupported Features....227

CoreWCF Improvements over WCF....229

ASP.NET Web API....233

Migrating Controllers....234

Explicit HTTP Methods....235

Routing....236

Action Results....238

Parameter Binding....241

Working with Files....242

Configuration....245

Compatibility with Newtonsoft.Json....247

Authentication....248

Host Authentication....249

Custom Authentication Filters....251

JWT and OWIN-Based Authentication....255

Unifying the OpenAPI Metadata....257

Configuring Client Proxy Generation....258

Diff Tools....260

ASP.NET SignalR....264

Migration of SignalR Hubs....265

Authentication and Authorization....268

Persistent Connections....274

Migration of Client Applications....274

Automatic Reconnects....277

Scaling....279

Summary....282

Chapter 5: Migrating Data Access....283

Migrating ADO.NET Primitives....286

SQL Server....286

Connection Encryption by Default....291

SQLite....293

Oracle....294

LINQ to SQL....294

Lazy and Eager Loading....302

Scaffolding Entity Framework Core Model....307

Other Differences....308

Entity Framework....311

Choose Between Entity Framework and Entity Framework Core....312

Migrate ObjectContext to DbContext API....314

Database First Approach with Entity Framework and the New .NET....319

Migrate to Entity Framework Core....320

Scaffolding....321

Porting the Code First Model....326

Lazy Loading....333

Configuration and Connection Strings....333

ASP.NET Identity Tables....335

Testing....336

Differences in Complex Queries....337

Migrations....341

Migrating the Entity Framework Migrations....343

Summary....349

Chapter 6: Migrating Identity Stores....350

ASP.NET Membership Providers....353

Insecure Passwords....356

Migration to ASP.NET Core Identity....358

Migration of Passwords....363

Do Not Keep Passwords in the Original Format....364

Storing the Old Password Hashes Securely....364

Other Password Formats....373

ASP.NET Universal Providers....374

Migration to ASP.NET Core Identity....376

Migrating User Profiles....377

ASP.NET Identity....389

Migration to ASP.NET Core Identity....391

Authentication in ASP.NET Core....399

Using ASP.NET Core Identity....403

Summary....407

Chapter 7: In-Place Migration of Web UI Applications....408

Trivial Applications....410

In-Place and Side-by-Side Migration....411

Modernization Using DotVVM....413

A Brief History....415

Model-View-ViewModel on the Web....420

Communication with the Server....424

Before You Start....429

Prerequisites....430

Coexistence of DotVVM and Web Forms....431

Migrating the Master Page....436

Migrating the Pages....439

Migrating Components....440

Handlers....445

The Final Step....447

Practical Example....449

Running the Project....451

Adding DotVVM....454

Master Page and the First Page....454

Migrating the Other Pages....467

Switching to the New .NET....472

Authentication and Authorization....474

Other Changes....477

Wrapping Up....479

Summary....480

Chapter 8: Side-by-Side Migration of UI Applications....481

Initial Setup....482

Create the New ASP.NET Core Application....484

Forwarded Headers....494

Server Configuration....497

Sharing Code Between the Applications....498

Migrating the First Page....506

Choosing the UI Framework....507

Adding Blazor Server....508

Migrating Layout Page....511

Migrating First Page....516

Sharing the Session....519

Remote Session....523

Remote Session in Blazor Server....527

Sharing the Authentication State....533

Remote Authentication....534

External Identity Providers....536

Cache Invalidation....539

Distributed Caching....540

Custom Solution Based on SignalR....541

Other Considerations....548

Filesystem Access....548

Concurrency and Locking....552

Migrating Remaining Pages....555

Migrating the Handler....561

Moving Static Files....563

Completing the Migration....564

Remove the Session....564

Switch the Authentication....566

Caching....571

Removing the Old Application....573

Summary....575

Chapter 9: Migration of ASP.NET MVC and Web Pages....576

Available Frameworks....576

Choosing the Technology....581

ASPX View Engine....584

Preparing the Migration....586

Migrating ASP.NET Web Pages....590

Routing....592

Migrating the Layout Page....594

The First Page....598

Migration of Remaining Pages....600

Route Parameters....601

Validation....602

Forms and Binding....604

Authorization....606

Unsupported Features....607

Migrating ASP.NET MVC....608

Upgrading Controllers....608

Fixing the Upgrade Issues....613

Migration of Remaining Pages....618

Final Step....619

Summary....622

Chapter 10: A Word on Architecture....624

Clean and Readable Code....626

Layering....632

Code Consistency and Conventions....652

Testing....655

Unit Tests....656

Integration Tests....658

Integration Tests with Database....663

User Interface Tests....667

Summary....670

Conclusion....671

In 2016, Microsoft introduced the new generation of .NET called .NET Core. It brought many fundamental improvements to the platform, but there were also many breaking changes and missing APIs, especially when it comes to creating web applications. Upgrading any website running on .NET Framework to the new .NET Core proved to be a complex process, which can take months or even years.

This book describes two approaches you can take to incrementally modernize legacy .NET web applications. It explains the changes that happened in ASP.NET MVC, ASP.NET Web API, Entity Framework, ASP.NET Identity, SignalR, and other libraries. It also shows a migration path for applications written in ASP.NET Web Forms: a technology which isn’t supported in the new .NET at all.

In addition, the book describes the new frameworks available in the ASP.NET Core platform (Blazor, Razor Pages, ASP.NET Core MVC, SignalR Core, and so on) and helps you decide which technology will be the best fit.

The book also covers several “soft” areas: how to explain the benefits or necessity for the modernization to your company management, how to deal with refactoring and improving the overall code quality during the entire process, and how to adjust the architecture of the application to be ready for another technology upgrade in the future.

The topic of modernization is highly relevant. There are still plenty of legacy .NET applications that are being actively developed and maintained. Many of them were developed for 10+ years, they involve plethora of company-specific know-how, and it is not economically feasible to rewrite them from scratch.

What You Will Learn

  • Discover the changes you need to make in a legacy ASP.NET application to migrate it to .NET 8 and beyond
  • Estimate the required effort and prepare the entire process
  • Use the In-place or Side-by-side approach to modernize your application incrementally
  • Migrate from ASP.NET Web Services or WCF to REST or gRPC
  • Migrate from ASP.NET SignalR to SignalR Core or from Entity Framework to EF Core
  • Migrate from Forms Authentication to ASP.NET Identity
  • Migrate ASP.NET Web Forms to Blazor Server or DotVVM
  • Migrate ASP.NET MVC and Web Pages to ASP.NET Core MVC and Razor Pages
  • Refactor and clean up your codebase to make it more maintainable

Who This Book Is For

.NET developers who work with ASP.NET web applications running on the .NET framework, and tech leads and software architects who make technical decisions about legacy .NET projects used in their organization


Похожее:

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

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