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

Creating APIs quickly

With .NET 8, APIs are integrated into the framework, making it easier to create, test, and document. In this section, we’ll learn a quick and easy way to create a minimal API using Visual Studio 2022 and walk through the code it generates. We’ll also learn why minimal APIs are the best approach to building REST-based services.

Using Visual Studio

One of the features of .NET 8 is the ability to create minimal REST APIs extremely fast. One way is to use the dotnet command-line tool and the other way is to use Visual Studio. To do so, follow these steps:

  1. Open Visual Studio 2022 and create an ASP.NET Core Web API project.
  2. After selecting the directory for the project, click Next.
  3. Under the project options, make the following changes:
    • Uncheck the Use Controllers option to use minimal APIs
    • Check Enable OpenAPI support to include support for API documentation using Swagger:
Figure 9.1 – Options for a web minimal API project

Figure 9.1 – Options for...

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