Use ASP.NET Core route-to-code for simple JSON APIs

In this post, we explore how you can use route-to-code instead of controllers, and the benefits and drawbacks.

When you need to write an API in ASP.NET Core, you’ve traditionally been forced to use ASP.NET Core MVC. While it’s very mature and full-featured, it also runs against the core principles of ASP.NET Core—it’s not lightweight or as efficient as other ASP.NET Core offerings. As a result you’re saddled... [Read More]

Use Azure Functions, Azure Storage blobs, and Cosmos DB to copy images from public URLs

In this post, we work with Azure Storage blobs and Cosmos DB to copy images that are available over the public Internet.

There are several reasons why you’ll want to host publicly accessible images yourself. For example, you may want to compress them or apply metadata for querying purposes on your site. For my Blast Off with Blazor project, I had that exact need. [Read More]

Simplify your ASP.NET Core API models with C# 9 records

In this post, a quick tip about how to use records to simplify your API models.

Out of all the new capabilities C# 9 brings, records are my favorite. With positional syntax, they are immutable by default, which makes working with data classes a snap. I love the possibility of maintaining mutable state in C# where appropriate, like for business logic, and maintaining immutability (and data... [Read More]
Tags: aspnet-core