How can you bind a configuration section to an object?

A Configuration section can be bound to a strictly-typed class object in two ways:

  • use Configuration.Bind() by passing the configuration section to bind and the object to which the values are mapped.
  • use services.Configure() to bind a section to a type and access the type by means of IOptions, IOptionsSnapshot or IOptionMonitor interface.

A Configuration section can be bound to a strictly-typed class object in two ways:

  • use Configuration.Bind() by passing the configuration section to bind and the object to which the values are mapped.
  • use services.Configure() to bind a section to a type and access the type by means of IOptions, IOptionsSnapshot or IOptionMonitor interface.

Buy Me A Coffee

Found this article helpful? Please consider supporting!

Ram
Ram

I'm a full-stack developer and a software enthusiast who likes to play around with cloud and tech stack out of curiosity. You can connect with me on Medium, Twitter or LinkedIn.

Leave a Reply

Your email address will not be published. Required fields are marked *