Try out Dometrain Pro for FREE with our new 7-day trial!

From Zero to Hero: Configuration and Options in .NET

Learn how to use Configuration and Options in any .NET codebase

Configuration is one of the core fundamentals of any .NET application. Whether it's a web application, an API, a desktop application or anything in between, every application has settings and options that make it configurable, flexible and functional. From simple numbers and booleans to connection strings that need to be stored and loaded securely, everything needs to be handled with care and a complete understanding of how they work and what is happening under the hood. In this course, Microsoft Senior Content Developer David Pine will teach you everything you need to know to get up to speed with Configuration and Options in .NET.

Curriculum

Welcome

01:14

What will you learn in this course?

01:45

Who is the course for and prerequisites

00:34

Introduction

00:49

What is Configuration?

01:45

Why configuration is important?

01:38

Configuration in .NET

01:28

Configuration sources & providers

01:11

First Configuration NuGet package

02:47

Explore the IConfiguration and related APIs

07:34

Section Recap

01:21

Introduction

01:08

Standalone vs. Host

04:04

What’s a ConfigurationManager?

01:21

Exploring the Worker Service default configuration

01:30

Running the Worker Service with template behavior

00:34

Learning the JSON configuration provider capabilities

01:45

Environment specific configuration

02:56

Configuring and manually parsing custom values

01:43

Benefiting from the Binder package

01:41

Section Recap

01:31

Introduction to Configuration Providers

00:37

Base File Providers

00:47

Discussing the empty application builder sample app

01:13

JSON configuration provider

03:00

XML configuration provider

01:51

INI configuration provider

01:48

User Secrets configuration provider

01:36

Managing user secrets

06:36

Environment Variables configuration provider

02:31

Command-line configuration provider

03:31

Key-per file configuration provider

02:25

Azure Key Vault configuration provider

04:10

Azure App Configuration provider with Key Vault secrets

03:36

Section Recap

00:59

Introduction to Implementing a Custom Configuration Provider

01:31

Create the implementation class library

01:35

Implement the IConfigurationSource

01:23

Implement the IConfigurationProvider

02:27

Extend IConfigurationBuilder and expose AddYamlFile APIs

02:22

Implementing the YAML parser

09:35

Review and Finalize implementation details

02:11

Consuming YAML configuration with custom provider

04:30

Section Recap

01:07

Introduction to the Options Pattern

02:09

Modeling the Logging Options

02:09

Bind Logging Options to Configuration

01:50

Consuming Logging Options through DI

02:41

Adding another options-modeled object

01:02

Binding additional named-options

01:48

Configuring and editing named-options

01:30

Resolving named-options by name

01:30

Verifying configuration bindings and DI hydration

01:13

Considering alternative APIs for registering options

01:40

Overriding configurations with post configure APIs

02:15

Overriding all config-bound instances

01:52

Avoid implementing IOptions<T>

01:58

Understanding reflection-based binding

02:14

Enabling source-generated configuration binding

02:05

Section Recap

01:01

Introduction to Validating Options

01:42

Implementing the IValidateOptions<TOptions> interface

05:07

Registering options with validation

03:03

Using data-annotations for declarative validation

04:45

Handling validation errors

04:36

Expressing simple delegate-based validation with fluent APIs

03:21

Controlling when validation errors occur

02:24

Compile-time validation with source-generators

04:07

Section Recap

01:36

Introduction to Options Monitoring

01:14

Differentiating Options interfaces

02:10

Visualizing an Alerting App Scenario

01:07

Exploring the Alerting Implementation

07:47

Post Code-walk: Options and Settings

03:08

Changing Config Data & Monitoring Alerts

02:04

Being Mindful of Monitoring Limitations

01:32

Section Recap

01:13

Introduction to Consumer-Centric (Empathy-based) Authoring

00:53

Defining Strongly-typed WidgetOptions

01:26

Debating namespace Naming: IServiceCollection Extensions

01:11

Exploring an Add* with IConfigurationSection API

01:55

Consuming the Add* with IConfigurationSection

03:35

Improving consumer experiences through meaningful error messages

01:35

Confirming new consumer experiences

01:52

Considerations when accepting Option-types as Add* API parameters

01:53

Consuming the Add* with Options-type API

02:18

Exposing an Action<WidgetOptions> API

01:43

The Importance of Consistent APIs

01:58

Using the configureOptions delegate-based API

02:29

Section Recap

01:19

Conclusion

01:23

Course Info

Level:
From Zero to Hero
Duration:
3h 28m
Rating (New):
star

Lifetime access

Add to Cart
Dometrain Pro

Want access to all of our courses? Subscribe to Dometrain Pro!

Try it for free!

About the Author

author_img

David Pine

David Pine works in Developer Relations at Microsoft, focusing on .NET and Azure developer content. He is recognized as a Google Developer Expert in Web Technologies. David is the O'Reilly Media author of "Learning Blazor: Build Single-Page Apps with WebAssembly and C#". David focuses on the developer community, actively seeking opportunities to share knowledge through speaking engagements around the world. David advocates for open-source, the .NET Foundation, C#, TypeScript, SignalR, Reactive Extensions, Azure and .NET. He's a co-host of the On .NET Live stream, part of the .NET Live TV family of streaming shows.

More courses by David Pine