How to use EF Core query types in ASP.NET Core 7

Entity Framework Core (EF Core for short) is a popular ORM (object-relational mapper) from Microsoft that allows you to perform CRUD operations (create, read, update, and delete) without having to know how the data is persisted in the underlying database. When working with ORMs, we often leverage models that are mapped to database tables. However, … Read more

6 state management techniques for ASP.NET Core MVC

Because HTTP is a stateless protocol, state information is not preserved between requests. This means you must write your own logic to maintain state or find another way to preserve state information. This article will explore some of the most common state management techniques available in ASP.NET Core MVC and how to use them in … Read more

Use model validation in minimal APIs in ASP.NET Core 6

When working with applications in ASP.NET Core 6 you will often want to validate your models to ensure that the data they contain conform to the pre-defined validation rules. Enter model validation. We’ve discussed how we can get started with minimal APIs in an earlier article. This article discusses how to use model validation in … Read more

How to use cancel tokens in ASP.NET Core 7

Although ASP.NET Core 7 is the latest version of Microsoft’s open source web application development framework, it takes advantage of countless significant features from previous versions of .NET. One of these significant features is cancellation tokens, which provide a way of gracefully handling multi-threaded applications. When working with ASP.NET Core applications, it is good practice … Read more

How to use route handler filters in minimal APIs in ASP.NET Core 7

ASP.NET Core 6 introduced a simplified hosting model that allows us to build lightweight APIs with minimal dependencies. Minimal APIs in ASP.NET Core 6 don’t use controllers, and they lack support for a number of useful ASP.NET features. One of these missing features is filters. However, with ASP.NET Core 7 (now available in a release … Read more

How to create a custom configuration provider in ASP.NET Core 6

We use configuration providers in ASP.NET Core to load configuration data into our application from one or more configuration sources. These providers can read configuration data from command line arguments, environment variables, JSON or XML files, databases, Azure Key Vault, and other sources—including your own custom sources. The ASP.NET Core configuration system comprises a set … Read more

How to use EF Core as an in-memory database in ASP.NET Core 6

There are many reasons why you might want to use an in-memory database when working on ASP.NET Core 6 web applications. Maybe you’re developing a new feature and you want to test it without affecting your production database. Or perhaps you want a quick way to prototype something without setting up a whole new database. … Read more

How to version minimal APIs in ASP.NET Core 6

ASP.NET Core 6 introduces a simplified hosting model that allows us to build lightweight APIs with minimal dependencies. We have discussed getting started with minimal APIs, using logging and dependency injection with minimal APIs, and testing minimal APIs in previous article here. In this article, we’ll examine how we can implement versioning for our minimal … Read more