Sign In Start Free Trial
Account

Add to playlist

Create a Playlist

Modal Close icon
You need to login to use this feature.
  • Book Overview & Buying ASP.NET 8 Best Practices
  • Table Of Contents Toc
  • Feedback & Rating feedback
ASP.NET 8 Best Practices

ASP.NET 8 Best Practices

By : Jonathan R. Danylko
4.8 (15)
close
close
ASP.NET 8 Best Practices

ASP.NET 8 Best Practices

4.8 (15)
By: Jonathan R. Danylko

Overview of this book

As .NET 8 emerges as a long-term support (LTS) release designed to assist developers in migrating legacy applications to ASP.NET, this best practices book becomes your go-to guide for exploring the intricacies of ASP.NET and advancing your skills as a software engineer, full-stack developer, or web architect. This book will lead you through project structure and layout, setting up robust source control, and employing pipelines for automated project building. You’ll focus on ASP.NET components and gain insights into their commonalities. As you advance, you’ll cover middleware best practices, learning how to handle frontend tasks involving JavaScript, CSS, and image files. You’ll examine the best approach for working with Blazor applications and familiarize yourself with controllers and Razor Pages. Additionally, you’ll discover how to leverage Entity Framework Core and exception handling in your application. In the later chapters, you’ll master components that enhance project organization, extensibility, security, and performance. By the end of this book, you’ll have acquired a comprehensive understanding of industry-proven concepts and best practices to build real-world ASP.NET 8.0 websites confidently.
Table of Contents (14 chapters)
close
close

What this book covers

Chapter 1, Taking Control with Source Control, addresses why source control is important, identifying and selecting a branching workflow, why tags are important, and proper commit etiquette.

Chapter 2, CI/CD – Building Quality Software Automatically, defines what CI/CD is, understanding and preparing code for a pipeline along with identifying two “falling” approaches when errors appear, how to deploy databases, and the various types of CI/CD providers, such as Azure, AWS, and Google Cloud Platform.

Chapter 3, Best Approaches for Middleware, explains what middleware is and how to optimize a middleware pipeline, using request delegates and extension methods, along with building an example middleware component.

Chapter 4, Applying Security from the Start, covers why security should be a top concern before, during, and after writing code, as well as common security practices. The chapter concludes by addressing the top three security threats on the internet.

Chapter 5, Optimizing Data Access with Entity Framework Core, looks at the different types of implementations of Entity Framework and how each one is used, why logging and async/await is important, how to use resources for large seed data, and why sometimes it’s better to bypass LINQ and use stored procedures.

Chapter 6, Best Practices for Web User Interfaces, examines what a task runner is, why they’re important, and how to create a workflow using one, along with reviewing UI standards such as centralizing site URLs, why controllers/pages should be small, why ViewComponents are beneficial, and how to create SEO-friendly URLs.

Chapter 7, Testing Your Code, explains the various types of testing concepts used in ASP.NET applications, why writing unit tests is important, why “100% test coverage” isn’t necessary, how to properly structure your unit tests with the triple-A approach (AAA), when to avoid writing extra unit test helpers, and how to use tests as documentation.

Chapter 8, Catching Exceptions with Exception Handling, reviews the different types of exception handling, how and when to use exception handling, and using global exception handling. It also covers logging, how unit testing and exceptional handling are similar, why empty try..catch blocks are wasteful, how to use exception filtering and pattern matching, and knowing when to use finally blocks.

Chapter 9, Creating Better Web APIs, demonstrates various practical API techniques, such as designing, creating, and testing APIs quickly, along with applying the right HTTP verbs and status codes to an API, how to implement a pagination structure, versioning, and DTOs into your APIs, and why creating a new HttpClient should be avoided.

Chapter 10, Push Your Application with Performance, takes everything we’ve learned throughout the chapters and applies a performance perspective to it. We’ll cover why performance is so important and why it matters, how to establish client, C# code, and database baselines, along with image optimization, minimizing requests, using CDNs, implementing async/await, how to automatically optimize HTML, Entity Framework Core optimizations, and caching strategies.

Chapter 11, Appendix, will review the fundamental terms used throughout the industry, such as the DRY, YAGNI, KISS principles, along with separation of concerns, how to refactor code, understanding the SOLID principles, and how to structure various project types in Visual Studio.

Unlock full access

Continue reading for free

A Packt free trial gives you instant online access to our library of over 7000 practical eBooks and videos, constantly updated with the latest in tech
bookmark search playlist download font-size

Change the font size

margin-width

Change margin width

day-mode

Change background colour

Close icon Search
Country selected

Close icon Your notes and bookmarks

Delete Bookmark

Modal Close icon
Are you sure you want to delete it?
Cancel
Yes, Delete

Confirmation

Modal Close icon
claim successful

Buy this book with your credits?

Modal Close icon
Are you sure you want to buy this book with one of your credits?
Close
YES, BUY