Skip to content

Improve the performance of configuration binding #36130

Open
@Kahbazi

Description

@Kahbazi

Is your feature request related to a problem? Please describe.

I have a configuration class which contains over 50 properties. I want to get the new configuration for each request so IOptionsSnapshot is my choice, but the problem is that configuration is using Reflection to bind the options for each request. And for obvious reasons it can't be cached like IOptions or IOptionsMonitor.

Also breaking the configuration class to multiple class is not an option here.

Describe the solution you'd like

Is it good idea to create a method using ILGenerator at runtime and use that to bind the configuration class? I assume once the method is created it has better performance than reflection.

P.S. I'm willing to create a PR for this.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions