Generate a Kiota client at build time from an ASP.NET Core OpenAPI file

 
 
  • Gérald Barré
In a previous post, I explained how to generate the OpenAPI document during the ASP.NET Core build and commit it to the repository. That gives you a versioned API contract that is easy to review in pull requests. In this post, let's go one step further: use that generated OpenAPI file as the input for Kiota, so your typed .NET client is also generated during build. The goal is simple: The server produces… [read more]

New features and Roslyn analyzers for Meziantou.Framework.FullPath

 
 
  • Gérald Barré
A few years ago, I introduced , a library to ensure you always deal with full paths in your applications and provide common methods to manipulate them easily. Recently, I've added new features to the library, including new methods and a set of Roslyn analyzers to help you use the library correctly. The main idea of FullPath is to avoid bugs related to relative paths by forcing the use of absolute paths… [read more]

PowerShell Parameter Validation Attributes

 
 
  • Gérald Barré
PowerShell provides a set of validation attributes that enforce constraints on parameters and variables. These attributes validate input at runtime, making your scripts more robust and reducing the need for manual validation logic. Overview Validation attributes can be applied to: Function or script parameters Script-level variables Class properties When validation fails, PowerShell throws an exception… [read more]

Using the Unicode Fraction Slash instead of HTML sub/sup tags

 
 
  • Gérald Barré
When you need to display fractions in HTML, you might reach for the <sub> and <sup> tags. However, there's a simpler Unicode-based alternative: the fraction slash character (U+2044). What is the Fraction Slash? The fraction slash (⁄) is a Unicode character that automatically formats surrounding digits as a fraction. When placed between two digits, most modern browsers and fonts render it as a proper… [read more]

Blazor - How to set a base component for all Razor components

 
 
  • Gérald Barré
When building a Blazor application, you may want a custom base component for all your Razor components. This is useful for sharing common functionality like cancellation tokens, logging, or state management across all components. Instead of adding @inherits YourBaseComponent to every Razor file, you can use the _Imports.razor file to set it globally. Using _Imports.razor to set a default base component… [read more]

Disable HTTP caching by default in ASP.NET Core APIs

 
 
  • Gérald Barré
When building APIs with ASP.NET Core, it's crucial to explicitly control caching behavior. Unlike web pages where caching often improves user experience, API responses should not be cached by default unless you intentionally design them to be cacheable. Unintended caching can lead to serious issues, including stale data, security vulnerabilities, and hard-to-reproduce bugs. Understanding HTTP caching… [read more]