Configuring Custom Database Schemas for Duende IdentityServer

DB Contexts in IdentityServer Entity Framework Core’s default behavior is to create all tables in the default database schema. When working with Duende IdentityServer, you may want to organize your data in separate schemas for better organization and security. IdentityServer’s standard configuration uses two separate DbContexts for different types of data. The ConfigurationDbContext is responsible for storing configuration data such as clients, resources, and scopes. The PersistedGrantDbContext stores operational data including grants, server sessions, and managed keys....

January 17, 2025 · 3 min · 464 words · John Bowen

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