Skip to main content

3 posts tagged with "HostedServices"

View All Tags

· 3 min read
Adnan Rafiq
How to use Serilog with Application Builder

Logging

Logs are facts emitted by your application especially when it is running in production.

Structured logging is a way to give facts a shape so that you can query logs better.

Serilog is a structured logging library for .NET and it is one of the most popular logging libraries in .NET.

But how to use Serilog with the new .NET 8 Worker template?

· 5 min read
Adnan Rafiq
Validate Options on Startup

Validate Options<T> on Startup in .NET 8

The .NET 8 Host Builder allows you to bind configuration with C# objects by using AddOptions<T> and binding to the configuration.

It provides you an opportunity to validate the configuration values when the host (WebApplication or Hosted Server) is starting by using ValidateOnStart.

But there are two interesting aspects of it, which I will explain in this post.

· 8 min read
Adnan Rafiq
Validate Options on Startup

Validate Options<T> on Startup

The .NET 8 Host Builder allows you to bind configuration with C# objects by using AddOptions<T> and binding to the configuration.

It provides you an opportunity to validate the configuration values when the host (WebApplication or Hosted Server) is starting by using ValidateOnStart.

But there are two interesting aspects of it, which I will explain in this post.