The book
ASP.NET 8 Best Practices
Need guidelines to write awesome code? Improve your ASP.NET Core skills with over 120 real-world, industry-proven best practices.
ASP.NET 8 Best Practices uses 20 years of real-world web experience to teach developers how to apply common and recommended practices to make your code more efficient and maintainable. It is my first book, from Packt Publishing.
What the book gives you
Over 120 best practices
Real-world, industry-proven recommendations for writing ASP.NET Core websites, each a small, bite-sized idea you can use right away.
Code that is easier to live with
Learn how to apply common and recommended practices so your code is more efficient and maintainable, drawn from what worked (and what did not) across 20 years of web projects.
Advanced techniques, made practical
Learn concepts like version control and CI/CD pipelines along with Entity Framework Core, Web APIs and Middleware, the parts of a project that decide how it ages.
For every level
It is a reference for ASP.NET developers, whether you are a beginner, intermediate or experienced. The chapters follow what a developer meets across a career.
A reference you come back to
The content is meant to be “evergreen”, written to stay relevant for at least the next five years. Use it when you need a common question answered or want to know how to structure your code.
Modern .NET 8, in thirds
It uses the latest .NET 8 language features to show why one way of writing code is the more common one. Each chapter is an introduction with terms and concepts, then the best practices, then a demo combining it all.
“Best practice” can be an opinionated term. Every recommendation is a recommended or common way to achieve something in ASP.NET 8, and as the book says, your mileage may vary: an approach may not suit your situation, and may be only one alternative.
What you will learn
Ten chapters, in the order an ASP.NET developer meets them: how software is shipped first, then the ASP.NET technologies, then how to make them faster.
Taking Control with Source Control
- Why source control is considered a developer’s superpower
- Identifying and selecting a branching workflow
- Why tagging is important
- Understand proper commit etiquette
Building Software with Software (CI/CD)
- What is CI/CD?
- How to prepare code for a pipeline
- How to deploy databases
- Review the various types of cloud providers
Best Approaches for Middleware
- Using a Middleware pipeline
- Optimize your Middleware pipeline
- Using delegates and extension methods
- Creating your own Middleware component
Applying Security From The Start
- Why security is important
Optimizing Data Access Using Entity Framework
- Various ways to implement Entity Framework Core
- Why async/await is important
- Using Resources for large seed data
- Identify better alternatives to using LINQ
Best Practices with Web UIs
- Reasons to use Task Runners
- Create client-side workflows
- Benefits of centralizing site URLs
- Using Helpers, ViewComponents and Blazor components
Testing Your Code
- Understanding various testing concepts
- Benefits of using the triple-A (AAA) approach
- Why it is important to avoid writing extra unit test helpers
- Using unit tests as documentation
Catching the Exceptions with Exception Handling
- Understanding different types of exception handling
- Implementing global exception handling and logging
- Why empty catch blocks are wasteful
- Using pattern matching with exception filtering
Creating Better Web APIs
- Techniques like designing, creating and testing APIs
- Creating intuitive APIs using HTTP verbs with status codes
- Implement API pagination
- Why it is important to avoid creating Http Clients
Push Your Application with Performance
- Why performance is so important and why it matters
- How to establish baselines
- Learn client-side performance techniques
- Optimizing Entity Framework Core and optimizing HTML
An appendix of programming guidelines closes the book.
What readers say
Read what other developers wrote about the book: