Posts about Blazor

Shared Blazor WebAssembly and Hybrid code

March 24th 2023 Blazor .NET MAUI

The Blazor WebAssembly and Blazor Hybrid hosting models have a lot in common, and if you want to offer your application as both a SPA (or even a PWA) and a (hybrid) native application, you can share a lot of code between the two. Unfortunately, there is no project template with everything set up for you, but there is official documentation on how to do it yourself.

Platform code in Blazor Hybrid

March 17th 2023 Blazor .NET MAUI

The new Blazor Hybrid hosting model allows seamless execution of native platform code from Blazor pages and components. This is also made clear in the official documentation. Surprisingly, I could not find an example or tutorial for this, so I decided to create one myself.

TypeScript Interop in Blazor

March 10th 2023 Blazor TypeScript JavaScript

Although Blazor makes it possible to develop single-page applications in C# instead of JavaScript or TypeScript, there are still cases where you need to call JavaScript code to accomplish something, such as calling browser APIs or interacting with existing JavaScript libraries. This is called JavaScript interoperability and is well documented. However, it does not mention how you can use Typescript instead of JavaScript.

Reuse model validation in Blazor client

March 3rd 2023 Blazor

In my last blog post about sharing contract types between the Blazor client and the backend, I mentioned that this can include business logic. A common part of business logic that can be shared in this way is model validation.

Share backend contract with Blazor client

February 24th 2023 Blazor

In general, you can create client-side types for invoking HTTP web services from Blazor using the OpenAPI code generator just as you would for any SPA framework or other client. However, if the web service is also developed in .NET and you have control over it, you can share the types and libraries through a common class library instead.

Debounce search calls in Blazor WebAsm

March 25th 2022 Blazor ReactiveX

In modern user interfaces, it is common to respond to user input immediately, without waiting for the user to submit it. This can be inefficient because the user is usually not interested in the intermediate results for each letter, but only in the whole word they are typing. Without compromising usability, we could wait until the user stops typing for a while, and only then submit the search query. A common term for this behavior is debouncing.