The Code-Mind Interface

A blog to document discoveries on my journeys through designing and developing software solutions.

Visualizing .NET 8 Blazor Component Render Locations

The New World of .NET 8 Blazor originally allowed a choice of either Server or WASM (browser client) rendering, but this was an exclusive choice which applied across an entire application. Many things behave differently depending on where they are running, but there was no ambiguity within a single app. Now that .NET 8 is beginning to support the “Blazor United” concept of mixed rendering modes within an application, including adding a third option to statically pre-render in the style of Razor Pages, different parts of your application may render in different places, and can even switch modes on the fly at runtime!...

October 17, 2023 · 6 min · 1090 words · John Bowen

Adding Descriptions to Swagger Generated OpenAPI Documentation

Enhancing API Documentation Swashbuckle tooling for Swagger provides an easy way to document APIs in ASP.NET Core with out of the box functionality that creates a lot without additional customization. The OpenAPI spec allows for a lot of additional description to be included, and by annotating your code in appropriate places the Swagger generation can automatically fill these for you. Many of these additional descriptions also show up in the automatically generated Swagger UI....

September 30, 2023 · 7 min · 1327 words · John Bowen

Embedding appsettings.json Files for Single File Publishing

Appsettings.json Files The configuration system in ASP.NET Core is a flexible way to manage settings, with each of the different providers made available to apps as a unified IConfiguration object. Under normal circumstances adding settings to appsettings.json and environment specific appsettings files is an easy way to configure an app being deployed as a container or set of files on a web server, while also being flexible at development time. In other cases an app needs to be deployed as a single package with a fixed set of configuration settings included that shouldn’t be editable by end users....

August 20, 2023 · 4 min · 840 words · John Bowen

Adding Bearer Token Authentication to Swagger API Test UI in ASP.NET Core

Swagger OpenApi Doc Generation The Swagger tooling provided by Swashbuckle in ASP.NET Core can be used to auto-generate OpenAPI docs and a test UI for exercising your API through the browser without external tooling. The basic setup only requires a few lines of code and is currently optionally included in many of the standard dotnet templates that produce APIs. A simple setup includes adding two services and two middleware registrations:...

July 27, 2023 · 6 min · 1079 words · John Bowen

Maintaining Window Size and Position in MAUI Apps on Desktop

MAUI Desktop Windows With roots in Xamarin Forms, MAUI is primarily geared toward mobile OS environments. But with its ability to run on both Windows and Mac desktops it can be a useful option for desktop .NET apps to go cross-platform. Some desktop specific features can be painful to use, or even entirely unavailable, but things are improving with each release. Restoring window sizing and placement across app relaunches is one feature that makes a big usability difference for desktop apps, but doesn’t come for free....

June 17, 2023 · 3 min · 594 words · John Bowen