Options Pattern
Binding configuration to a typed class injected as IOptions<T>.
What is Options Pattern?
The options pattern binds a section of configuration to a typed class, which you inject as IOptions<T>.
public sealed class RecipeOptions { public int PageSize { get; set; } = 20; }
builder.Services.Configure<RecipeOptions>(builder.Configuration.GetSection("Recipes"));
public class RecipeService(IOptions<RecipeOptions> options) { }
Level: Journeyman · More ASP.NET Core terms at this level
Updated