Service Collections with Blazor Server

What is a service collection? Service collections are a way of registering and resolving dependencies in C# applications using the built-in dependency injection (DI) system. Blazor Server is a web framework that allows you to run C# code on the server and interact with the user interface through a SignalR connection. To use service collections…

Read more

In Memory State Management with Blazor Server

Creating your first In Memory State Container with Blazor Server Web technology has come along way in the relatively recent past. With the surge in popularity of SPAs and Javascript Frameworks a lot of developers have come to expect certain functionality out of the box. Blazor Server being a stateful application framework offers us a…

Read more

IHttpClientFactory vs. HttpClient

Why should you use IHttpClientFactory The main reason to use IHttpClientFactoryinstead of HttpClient directly is to manage the life cycle of HttpClient instances. HttpClient was designed to be instantiated once and reused throughout the application life cycle. If you continually instantiate new HttpClients you may unnecessarily be squandering resources. Another use case is for simplicities…

Read more

How to add HealthChecks to a ASP.net Core application

Adding HealthChecks to your application can drastically reduce troubleshooting time Why would you want to monitor your applications health? Health checks can test an applications dependencies, such as databases and external service endpoints, to confirm availability and normal functioning.  From Microsoft Out of the box Health Checks UI Here is how to monitor SQL Server…

Read more

Why are you experiencing a NullReferenceException on OnInitializedAsync() with Blazor?

Lets start with a sample Razor component that renders the UI: Component.razor Forename Surname Username @foreach (var user in Users) { @user.Forename @user.Surname @user.Username } Lets look at the ‘code behind’ (ooof I’m old) AKA a partial class that represents the logic of the component (view) Component.razor.cs public partial class Component { private string _url…

Read more