Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletter Hub
Free Learning
Arrow right icon
timer SALE ENDS IN
0 Days
:
00 Hours
:
00 Minutes
:
00 Seconds
ASP.NET 8 Best Practices
ASP.NET 8 Best Practices

ASP.NET 8 Best Practices: Explore techniques, patterns, and practices to develop effective large-scale .NET web apps

eBook
$9.99 $31.99
Paperback
$39.99
Subscription
Free Trial
Renews at $19.99p/m

What do you get with eBook?

Product feature icon Instant access to your Digital eBook purchase
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
Product feature icon AI Assistant (beta) to help accelerate your learning
OR
Modal Close icon
Payment Processing...
tick Completed

Billing Address

Table of content icon View table of contents Preview book icon Preview Book

ASP.NET 8 Best Practices

Taking Control with Source Control

Source control is a developer’s best friend and provides them with a way to experiment with code without losing important changes. Source control is the ability to track and maintain changes made to code throughout a development process. While this could include code, it can also be used for documentation, assets (such as images), and other resources. Being able to test certain conditions and the ability to refactor code without worrying about the code base is what most developers consider a superpower.

Source control is extremely important when working in a team environment. If a developer checks in code and later realizes they made a mistake, source control gives developers a way to revert changes or update a branch and re-commit. Companies not using some type of source control almost always raises a red flag.

In this chapter, we’ll look at common practices developers use in the industry when using source control. We’ll...

Technical requirements

While this section touches on a number of guidelines regarding source control, the only requirement for this chapter is a computer with any OS. Git is optional.

If you don’t have Git installed, you can download and install it at the following URL:

https://git-scm.com/

We have used mermaid-js to visually show the branching strategies. As of February 2022, GitHub pages now support Mermaid-js. Some of the sections will include mermaid diagrams to demonstrate the different branching hierarchies.

For more information on Mermaid-js, navigate to the following URL:

https://mermaid-js.github.io

Branching Strategies

In this section, we’ll explore various branching strategies, explaining how each one works, and highlighting the differences between them.

While every company has its unique workflow, we’ll focus on some commonly used strategies in the industry.

With GitFlow being the initial workflow, everyone is familiar with it in the industry and its successors have improved by making minor changes to the workflow.

In the next sections, we’ll discuss each workflow, but first, we have to understand the fundamentals of GitFlow.

GitFlow

One of the most common and most mature workflows in the industry is GitFlow. It was created by Vincent Driessen in 2010.

A minimal Git repository should have the following branches:

  • main/master/trunk (referred to as main from this point on)
  • develop

The main branch is what you start with when creating a new repository. The purpose of this branch is to always have stable and production-ready...

Creating short-lived branches

Once you have initialized your repository and created your first branch, you can start writing code for your feature.

While this is exciting, this guideline is meant more for teams as opposed to an individual building a side project. The larger the team, the more critical this becomes to your workflow.

Let’s look at an example using multiple feature branches in Figure 1.6.

Figure 1.6: Long-lived feature branch (feature/settings)

Figure 1.6: Long-lived feature branch (feature/settings)

Everyone is assigned their respective feature branches, which are created for them. As you can see, the developers are completing their features and checking them into develop.

However, the developer working on the settings feature (feature/settings) is behind. Their branch is becoming stale since they haven’t updated their code over the week. It only contains their feature from when they first created their branch.

What do you think will happen if they decide to commit their...

Understanding Common Practices

Technically, knowing how to use source control is only half the battle. The other half is working as a team player while using source control. The ability to keep your fellow teammates in mind will take you further in your career as you become a considerate and trusted developer.

The following sections are meant as guidelines to help you succeed in working in a team environment. If you work as an individual developer on an open source project, it doesn’t hurt to implement these practices as well.

Rebase when Private, Merge when Public

When working on a feature branch privately, there may be times where multiple commits are necessary. These commits add unnecessary noise to the main/master branch.

Rebasing your code takes a number of local commits and updates another branch with a single commit. It essentially rewrites the commit history. Of course, this differs from a merge. Merging is the process of taking all of the commits from one...

Summary

In this chapter, you learned about the different types of branching workflows available, including GitFlow, GitHub Flow, and GitLab Flow, and how each one works. Along with the workflows, you learned the industry-standard branch names, such as main/trunk/master, develop, features, release, and hotfix branches, and how they work in each workflow. You also learned the proper way to work with source control, such as always getting the latest code, when to rebase your code versus merging, allowing your branches to have a short lifespan, compiling and testing your code before committing, never checking in assemblies, and the proper use of tagging.

In the next chapter, we’ll take the source code in our repository and create an automated build to create artifacts. We’ll also cover how to automatically deploy it to a server.

Left arrow icon Right arrow icon
Download code icon Download Code

Key benefits

  • Get to grips with standard guidelines for every phase of the SDLC, encompassing pre-coding, coding, and post-coding stages
  • Build high-quality software by employing industry best practices throughout the development process
  • Apply proven techniques to improve your coding, debugging, and deployment processes for websites
  • Purchase of the print or Kindle book includes a free PDF eBook

Description

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.

Who is this book for?

This book is for developers who have working knowledge of ASP.NET and want to advance in their careers by learning best practices followed in developer communities or corporate environments. Beginners can use this book as a springboard for integrating best practices into their learning journey, and as a reference to gain clarity on advanced ASP.NET topics at a later time.

What you will learn

  • Explore the common IDE tools used in the industry
  • Identify the best approach for organizing source control, projects, and middleware
  • Uncover and address top web security threats, implementing effective strategies to protect your code
  • Optimize Entity Framework for faster query performance using best practices
  • Automate software through continuous integration/continuous deployment
  • Gain a solid understanding of the .NET Core coding fundamentals for building websites
  • Harness HtmlHelpers, TagHelpers, ViewComponents, and Blazor for component-based development

Product Details

Country selected
Publication date, Length, Edition, Language, ISBN-13
Publication date : Dec 29, 2023
Length: 256 pages
Edition : 1st
Language : English
ISBN-13 : 9781837634804
Languages :
Tools :

What do you get with eBook?

Product feature icon Instant access to your Digital eBook purchase
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
Product feature icon AI Assistant (beta) to help accelerate your learning
OR
Modal Close icon
Payment Processing...
tick Completed

Billing Address

Product Details

Publication date : Dec 29, 2023
Length: 256 pages
Edition : 1st
Language : English
ISBN-13 : 9781837634804
Languages :
Tools :

Packt Subscriptions

See our plans and pricing
Modal Close icon
$19.99 billed monthly
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Simple pricing, no contract
$199.99 billed annually
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just $5 each
Feature tick icon Exclusive print discounts
$279.99 billed in 18 months
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just $5 each
Feature tick icon Exclusive print discounts

Frequently bought together


Stars icon
Total $ 149.97
C# 12 and .NET 8 – Modern Cross-Platform Development Fundamentals
$59.99
Apps and Services with .NET 8
$49.99
ASP.NET 8 Best Practices
$39.99
Total $ 149.97 Stars icon
Banner background image

Table of Contents

13 Chapters
Chapter 1: Taking Control with Source Control Chevron down icon Chevron up icon
Chapter 2: CI/CD – Building Quality Software Automatically Chevron down icon Chevron up icon
Chapter 3: Best Approaches for Middleware Chevron down icon Chevron up icon
Chapter 4: Applying Security from the Start Chevron down icon Chevron up icon
Chapter 5: Optimizing Data Access with Entity Framework Core Chevron down icon Chevron up icon
Chapter 6: Best Practices with Web User Interfaces Chevron down icon Chevron up icon
Chapter 7: Testing Your Code Chevron down icon Chevron up icon
Chapter 8: Catching Exceptions with Exception Handling Chevron down icon Chevron up icon
Chapter 9: Creating Better Web APIs Chevron down icon Chevron up icon
Chapter 10: Push Your Application with Performance Chevron down icon Chevron up icon
Chapter 11: Appendix Chevron down icon Chevron up icon
Index Chevron down icon Chevron up icon
Other Books You May Enjoy Chevron down icon Chevron up icon

Customer reviews

Top Reviews
Rating distribution
Full star icon Full star icon Full star icon Full star icon Half star icon 4.8
(15 Ratings)
5 star 80%
4 star 20%
3 star 0%
2 star 0%
1 star 0%
Filter icon Filter
Top Reviews

Filter reviews by




Mike D. Jan 08, 2024
Full star icon Full star icon Full star icon Full star icon Full star icon 5
ASP.NET 8 Best Practices contains a variety of best practices related to .NET development with some general software development best practices. If someone is just starting in software development, there are more things to learn about source control than just what is mentioned in this book, but it isn’t set out to be a book on source control either. As a developer who has been in the industry for a while, there were still some things that I could get from this book. I’ve mostly worked on the .NET Framework, but not as much with the newer versions of .NET. Some of the concepts in this book only exist in the newer versions of .NET, so this book is also a good reference to learn those new features.
Amazon Verified review Amazon
Alex saavedra Jan 06, 2024
Full star icon Full star icon Full star icon Full star icon Full star icon 5
This book is an indispensable resource for any .NET developer eager to enhance their skills or delve into the language. Excellently crafted by Jonathan R. Danylko, it simplifies complex concepts into a straightforward approach complemented by practical examples, making it ideal for both beginners and seasoned professionals.What sets this book apart is its emphasis on best practices in ASP.NET development. It's not just about code samples; the author delves deep into the rationale behind each best practice, offering critical insights for creating robust .NET web applications. As you progress through the book, you gain a comprehensive understanding of ASP.NET, making it an invaluable guide for developers committed to mastering their skills. It is a great resource to refer to when you want to refresh your knowledge or want to improve your current code.
Amazon Verified review Amazon
Brett Mar 12, 2024
Full star icon Full star icon Full star icon Full star icon Full star icon 5
This a great resource for most people working in Net 8, applicable to more than just ASP. Definitely recommend to those starting, or soon starting, their first development jobs. The book has a lot of general best practices that newcomers could really benefit from, and the inclusion of testing makes it all the better.
Amazon Verified review Amazon
Cory Harkins Jan 08, 2024
Full star icon Full star icon Full star icon Full star icon Full star icon 5
ASP.NET 8 Best Practices is the go to handbook for modern asp.net engineering and proficient suggestions in the space.From start to finish there isn't a boring page in this book. It's taken me a while to read it but that's on me, not due to this book. Nearly every aspect of a project is covered here, from setup, middleware, security, speed and efficiency improvements, and much much more.
Amazon Verified review Amazon
jk Dec 29, 2023
Full star icon Full star icon Full star icon Full star icon Full star icon 5
ASP.NET 8 Best Practices is an excellent reference for developers seeking to improve their ASP.NET applications. In each chapter, the author starts by defining terms and explaining concepts, and then goes into providing detailed code examples, techniques, and procedures. This approach makes the book very accessible, while also providing concrete, advanced examples for more senior practitioners. I appreciated the availability of code samples, which are easily accessible through the book's GitHub repo. I also really enjoyed how the author added sprinkles of humor throughout the book.The book's checklist of best practices in each chapter is a particularly helpful feature, providing guidance to both novice and experienced developers in designing their code. In addition, the author recommends other information sources for deep dives into specific topics. In summary, this book is an excellent tool for developers seeking to review ASP.NET applications holistically. Its clear explanations, detailed code examples, and helpful best practice checklists make it a valuable reference for developers of all levels. I plan to use this book during my code reviews going forward!
Amazon Verified review Amazon
Get free access to Packt library with over 7500+ books and video courses for 7 days!
Start Free Trial

FAQs

How do I buy and download an eBook? Chevron down icon Chevron up icon

Where there is an eBook version of a title available, you can buy it from the book details for that title. Add either the standalone eBook or the eBook and print book bundle to your shopping cart. Your eBook will show in your cart as a product on its own. After completing checkout and payment in the normal way, you will receive your receipt on the screen containing a link to a personalised PDF download file. This link will remain active for 30 days. You can download backup copies of the file by logging in to your account at any time.

If you already have Adobe reader installed, then clicking on the link will download and open the PDF file directly. If you don't, then save the PDF file on your machine and download the Reader to view it.

Please Note: Packt eBooks are non-returnable and non-refundable.

Packt eBook and Licensing When you buy an eBook from Packt Publishing, completing your purchase means you accept the terms of our licence agreement. Please read the full text of the agreement. In it we have tried to balance the need for the ebook to be usable for you the reader with our needs to protect the rights of us as Publishers and of our authors. In summary, the agreement says:

  • You may make copies of your eBook for your own use onto any machine
  • You may not pass copies of the eBook on to anyone else
How can I make a purchase on your website? Chevron down icon Chevron up icon

If you want to purchase a video course, eBook or Bundle (Print+eBook) please follow below steps:

  1. Register on our website using your email address and the password.
  2. Search for the title by name or ISBN using the search option.
  3. Select the title you want to purchase.
  4. Choose the format you wish to purchase the title in; if you order the Print Book, you get a free eBook copy of the same title. 
  5. Proceed with the checkout process (payment to be made using Credit Card, Debit Cart, or PayPal)
Where can I access support around an eBook? Chevron down icon Chevron up icon
  • If you experience a problem with using or installing Adobe Reader, the contact Adobe directly.
  • To view the errata for the book, see www.packtpub.com/support and view the pages for the title you have.
  • To view your account details or to download a new copy of the book go to www.packtpub.com/account
  • To contact us directly if a problem is not resolved, use www.packtpub.com/contact-us
What eBook formats do Packt support? Chevron down icon Chevron up icon

Our eBooks are currently available in a variety of formats such as PDF and ePubs. In the future, this may well change with trends and development in technology, but please note that our PDFs are not Adobe eBook Reader format, which has greater restrictions on security.

You will need to use Adobe Reader v9 or later in order to read Packt's PDF eBooks.

What are the benefits of eBooks? Chevron down icon Chevron up icon
  • You can get the information you need immediately
  • You can easily take them with you on a laptop
  • You can download them an unlimited number of times
  • You can print them out
  • They are copy-paste enabled
  • They are searchable
  • There is no password protection
  • They are lower price than print
  • They save resources and space
What is an eBook? Chevron down icon Chevron up icon

Packt eBooks are a complete electronic version of the print edition, available in PDF and ePub formats. Every piece of content down to the page numbering is the same. Because we save the costs of printing and shipping the book to you, we are able to offer eBooks at a lower cost than print editions.

When you have purchased an eBook, simply login to your account and click on the link in Your Download Area. We recommend you saving the file to your hard drive before opening it.

For optimal viewing of our eBooks, we recommend you download and install the free Adobe Reader version 9.