Skip to content

IConfiguration type binding for properties in Options pattern. #42035

@armandjnbg

Description

@armandjnbg

Hello everybody,

I defined the following configuration option class for use with Options pattern:

public class RouteOptions
{
   public string Name { get; set; }
   public string Local { get; set; }
   public string Remote { get; set; }
   public string HttpClientName { get; set; }
   . . .
   public IConfiguration Extra { get; set; }
}

The "Extra" field by my design would include various extra settings that will be accessed by business logic located outside of my code, e.g. plugins written by other developers. I was expecting this to work, but to my surprise, this property is never assigned.

Probably it is very easy to bind this field it does not require any conversion, just assign GetSection("propertyName") to the property.

Is it possible to introduce this functionality?

I think it is essential.

With best regards,
Arman

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions