Skip to main content

3 posts tagged with "HostedServices"

View All Tags

Serilog with CreateApplicationBuilder in .NET 8 Worker or Hosted Service

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

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?

Validate Complex Types On Startup in .NET 8

· 4 min read
Adnan Rafiq
VP of Technology
Validate Options 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.

Validate Options<T> on Startup in Hosted Services in .NET8

· 8 min read
Adnan Rafiq
VP of Technology
Validate Options 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.