-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Closed
Description
Similar to #43359 but specifically for configuration binding. Support binding from IConfiguration to say a record or any immutable .NET object. This has been solved in JSON (it's basically deserialization) and we can use any lessons learned there to implement a solution in configuration.
public record Settings(string Color, int Length);
public void ConfigureServices(IServiceCollection services)
{
services.Configure<Settings>(Configuration.GetSection("MySettings"));
}iSeiryu, jessejohnsohn, adamgauthier, kimsey0, highstreeto and 27 moremanne, stevenbenitez, AgentFire, dzmitry-lahoda, HalidCisse and 3 more